itwiki:macos-homebrew

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
itwiki:macos-homebrew [2024/01/21 04:05] – [更换软件源] ovwx@live.ioitwiki:macos-homebrew [Unknown date] (当前版本) – 移除 - 外部编辑 (Unknown date) 127.0.0.1
行 1: 行 1:
-====== MACOS HOME-BREW 包管理器 ====== 
- 
-HOME BREW 是 MAC 或者 Linux 上非常流行的(特别是MACOS上)第三方软件包管理器 
- 
-HOME BREW 部件: 
- 
-  * homebrew-core --核心软件库 
-  * brew -- 源代码仓库 
-  * homebrew-cask --大型软件库 
-  * homebrew-bottle --预编译二进制库 
- 
-该包管理器相关数据和安装的软件包均在:/opt/homebrew 目录下 
- 
-===== HOME BREW 用到的环境变量 ===== 
- 
-<code> 
-HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles 
-HOMEBREW_CELLAR=/opt/homebrew/Cellar 
-HOMEBREW_PREFIX=/opt/homebrew 
-HOMEBREW_REPOSITORY=/opt/homebrew 
-INFOPATH=/opt/homebrew/share/info: 
-</code> 
- 
-换源的时候重新设置环境变量并用 export 导出即可,参见软件源更换的相关部分 
- 
-====== 安装 HOME BREW ====== 
- 
-注意挂上互联网工具 
- 
-<code> 
-export ALL_PROXY=socks5h://127.0.0.1:10808 
-export HTTP_PROXY=http://127.0.0.1:10809 
-export HTTPS_PROXY=http://127.0.0.1:10809 
-</code> 
- 
-一般来说设置 ALL_PROXY 也就够了 
- 
-一句话安装脚本 
- 
-<code> 
-/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
-</code> 
- 
-可以注意到安装需要 ruby 的支持,这个软件在 MAC 上已经有了,但是其他 *NIX 发行版上可能未必有,需要安装 
- 
-====== 包管理 ====== 
- 
-===== 常用命令 ===== 
- 
-  * 安装源码包: brew install PKG 
-  * 安装软件包: brew install PKG --cask #较早版本使用的 brew cask install 
-  * 删除软件包:brew uninstall PKG --cask #较早版本使用的 brew cask uninstall 
-  * 删除源码包:brew uninstall PKG 
-  * 查看已安装软件:brew list [--cask] 
-  * 升级软件包: brew upgrade PKG-NAME 
- 
-有源码包和编译包,使用 ''brew install PKG-NAME'' 是源码包,使用 ''brew install PKG-NAME --cask'' 安装的是二进制包。一般不用管,只要使用Search搜索了出来,系统会提示软件在哪个 channel 里面,如果在 CASK 里面,安装时就使用 ''--cask'' 选项。 
- 
-因为直接从GITHUB取数据,并且直接使用GITHUB REPO URL,所以不支持中文名,一些中文的软件可能要麻烦一点,可以参考:[[https://github.com/cactusnix/brew-apps|这个仓库]]查找对应中英文名称。 
- 
-===== 安装特定版本 ===== 
- 
-四个板斧 
- 
-  * 搜索软件包: brew search Keyword 
-  * 获取安装地址(一个可执行的 *.rb 脚本文件):brew info PKG-NAME 查看 ''FROM:'' 部分 
-  * 用浏览器打开那个.rb文件地址,点击右侧 ''History'' 并下载想要安装的历史版本的 .rb 文件,保存为:PKGNAME-$(VERSION).rb 
-  * 使用 brew 安装 rb 文件: brew install /path/to/PKGNAME-$(VERSION).rb 
- 
-注:如果之前已经安装了,系统会提示你进行移除或者卸载 
- 
-====== HOME BREW 本身的管理 ====== 
- 
-HOME BREW 安装的软件包保存在 ''/opt/home-brew'' 目录下 
- 
-===== HOME BREW 升级与重置 ===== 
- 
-  * 升级与重置brew缓存数据库:brew update [--auto-update] 
-  * 查看特定命令的帮助: brew help COMMAND 
- 
- 
-===== 更换软件源 ===== 
- 
-这个是可选项,有正常的互联网代理的话最好就不更换了。 
- 
-HOME BREW 的软件源完全是依赖 GIT 来管理的,它会通过GIT仓库和远端源进行映射来设置软件的下载地址,BREW 使用的 repo 
- 
-<code> 
-HOME: brew --repo 
-HOME-CORE: brew --repo homebrew/core 
-HOME-CASK: brew --repo homebrew/cask 
-</code> 
- 
-查看软件源信息 
- 
-<code> brew config </code> 
-==== 阿里源 ==== 
- 
-<code> 
- 
-# 查看 brew.git 当前源 
-$ cd "$(brew --repo)" && git remote -v 
-origin    https://github.com/Homebrew/brew.git (fetch) 
-origin    https://github.com/Homebrew/brew.git (push) 
- 
-# 查看 homebrew-core.git 当前源 
-$ cd "$(brew --repo homebrew/core)" && git remote -v 
-origin    https://github.com/Homebrew/homebrew-core.git (fetch) 
-origin    https://github.com/Homebrew/homebrew-core.git (push) 
- 
-# 修改 brew.git 为阿里源 
-$ git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git 
- 
-# 修改 homebrew-core.git 为阿里源 
-$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git 
- 
-# zsh 替换 brew bintray 镜像 
-$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc 
-$ source ~/.zshrc 
- 
-# bash 替换 brew bintray 镜像 
-$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile 
-$ source ~/.bash_profile 
- 
-# 刷新源 
-$ brew update 
- 
-</code> 
- 
-==== 清华源 ==== 
- 
-<code> 
-# 替换各个源 
-$ git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git 
-$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git 
-$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git 
- 
-# zsh 替换 brew bintray 镜像 
-$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc 
-$ source ~/.zshrc 
- 
-# bash 替换 brew bintray 镜像 
-$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile 
-$ source ~/.bash_profile 
- 
-# 刷新源 
-$ brew update 
-</code> 
- 
-==== 中科大 ==== 
- 
-<code> 
-# 替换各个源 
-$ git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git 
-$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git 
-$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git 
- 
-# zsh 替换 brew bintray 镜像 
-$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc 
-$ source ~/.zshrc 
- 
-# bash 替换 brew bintray 镜像 
-$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile 
-$ source ~/.bash_profile 
- 
-# 刷新源 
-$ brew update 
-</code> 
- 
-==== 官方源 ==== 
- 
-<code> 
-# 重置 brew.git 为官方源 
-$ git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git 
- 
-# 重置 homebrew-core.git 为官方源 
-$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git 
- 
-# 重置 homebrew-cask.git 为官方源 
-$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask 
- 
-# zsh 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置 
-$ vi ~/.zshrc 
-# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx 
- 
-# bash 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置 
-$ vi ~/.bash_profile 
-# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx 
- 
-# 刷新源 
-$ brew update 
- 
-</code> 
- 
-====== 国内安装HOME BREW ====== 
- 
-https://brew.sh/zh-cn/ 
- 
- 
- 
  
  • itwiki/macos-homebrew.1705806320.txt.gz
  • 最后更改: 2024/01/21 04:05
  • ovwx@live.io