homebrew
本身就是一个 git
仓库。使用 homebrew
安装软件包时,会自动先下载软件包,然后解压安装,但有时候下载会卡住,或者很慢,这个时候有以下几种方法:
1.临时的终止 update
,先 control+c
,停掉当前 update
,安装继续
2.更改更好用的 git
远程仓库
替换 homebrew
默认源(源代码仓库)
cd "$(brew --repo)"
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
替换 homebrew-core
源(核心软件仓库)
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
替换 homebrew-bottles
(预编译二进制软件包)
bash
用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh
用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
3.通过其他工具先将所需的软件包下载下来,注意版本一定要对应,homebrew
放置软件包源码的路径为 /Library/Caches/Homebrew/
,只要你将所需要的软件包下载正 确的版本,放置在此目录下,那么再使用brew install xxx
的时候,brew
就能直接安装了,有时候 brew install xxx
卡在下载界面,这招很管用。
首先执行 brew --help
或者 man brew
都会有下面的列表
Example usage:
brew search [TEXT|/REGEX/]
brew info [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]
Troubleshooting:
brew config
brew doctor
brew install --verbose --debug FORMULA
Contributing:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
Further help:
brew commands
brew help [COMMAND]
man brew
https://docs.brew.sh
或者
NAME
brew - The missing package manager for macOS
SYNOPSIS
brew --version
brew command [--verbose|-v] [options] [formula] ...
DESCRIPTION
Homebrew is the easiest and most flexible way to install the UNIX tools
Apple didn't include with macOS.
ESSENTIAL COMMANDS
For the full command list, see the COMMANDS section.
With --verbose or -v, many commands print extra debugging information.
Note that these flags should only appear after a command.
install formula
Install formula.
uninstall formula
Uninstall formula.
反正都是介绍 brew
命令的使用。个人觉的学会看这个,比看别人的博客来的快。
那么介绍一下常用的命令:
brew –help
#查看brew的帮助
brew install git
#安装git软件
brew uninstall git
#卸载git软件
brew search git
#搜索git软件
brew list
#显示已经安装软件列表
brew update
#更新软件,把所有的Formula目录更新,并且会对本机已经安装并有更新的软件用*标明。
brew upgrade git
#更新某具体软件
brew [info | home] [FORMULA…]
#查看软件信息
brew cleanup git
#单个软件删除,和upgrade一样
brew cleanup
#删除所有
brew outdated
#查看那些已安装的程序需要更新
brew home *
#用浏览器打开
brew info *
#显示软件内容信息
brew deps *
#显示包依赖
brew config
#查看brew配置