定义全局变量
//主要brew 命令目录 /usr/local/bin 注:homebrew在安装完成后自动在/usr/local/bin加个软连接,所以平常都是用这个路径
sudo vim /etc/profile
export PATH=/usr/local/bin:$PATH
echo $PATH
安装brew
官网
HomeBrew
//简介
brew是一个软件包管理工具,类似于centos下的yum或者ubuntu下的apt-get,非常方便,免去了自己手动编译安装的不便
brew 安装目录 /usr/local/Cellar
brew 配置目录 /usr/local/etc
brew 命令目录 /usr/local/bin 注:homebrew在安装完成后自动在/usr/local/bin加个软连接,所以平常都是用这个路径
//安装方法、终端输入命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Brew被墙解决办法
//更换代理
如果你想一劳永逸,就将其写在配置文件中,
如果你的终端是默认的bash就写在~/.bash+profile中,
echo export ALL_PROXY=socks5://127.0.0.1:1080 >> ~/.bash_profile
如果你的终端是zsh,那就写在~/.zshrc中
echo export ALL_PROXY=socks5://127.0.0.1:1080 >> ~/.zsh_profile
不过以上的弊端就是,可能你大部分终端的命令都会使用代理了
替换homebrew镜像源(自己选择是否需要更换)
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
//这个是添加在使用bash命令终端配置
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
//这个是添加在使用zsh命令终端配置
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.bash_profile
source ~/.zshrc
brew update
删除
open /usr/local
删除Homebrew