安装
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
可能遇到的问题
执行install报错
问题现象:
fatal: not in a git directory
Error: Command failed with exit 128: git
解决办法:
办法一:
执行 unset HOMEBREW_BOTTLE_DOMAIN
办法二:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
重启终端brew不能用
问题现象:
brew: command not found
解决办法:
按以下步骤执行:
- 编辑 bash_profile
- vim ~/.bash_profile
- 如果是intel芯片: 添加一行:export PATH=/usr/local/bin:$PATH
如果是苹果芯片(M1,M2): 添加一行: export PATH=/opt/homebrew/bin:$PATH - 如图:
-
如果终端用的是 zsh
- vim ~/.zshrc
- 在最后加入一行:source ~/.bash_profile
- 如图: