集美们,强烈推荐好吗?
还不心动吗,还不安装吗。
CentOS可以去看官网的链接,过程差不多
应该需要这几个,其他没写到的系统,可以自己装一下
curl file git
sudo apt-get install build-essential curl file git
sudo yum groupinstall 'Development Tools'
sudo yum install curl file git
sudo yum install libxcrypt-compat # needed by Fedora 30 and up
应该不区分Linux系统
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
mkdir ~/.linuxbrew/bin
ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
eval $(~/.linuxbrew/bin/brew shellenv)
到这里应该就结束了。
#清华和中科大选一个就好啦
cd "$(brew --repo)"
# 中国科大:
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清华大学:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中国科大:
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清华大学:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换homebrew-bottles:
# 中国科大:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 清华大学:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 应用生效:
brew update
顺便提一下怎么重置源,我就是不小心重置了 ( q w q )
# 重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
# 重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
换源相关来自这里
安装软件
brew的安装目录在 /usr/local/Cellar,我们以安装nodejs为例子,只需要执行:
brew install nodejs
就安装完了,就这么简单
更新软件
brew upgrade nodejs
卸载软件
brew remove nodejs
全是一条命令。
在介绍几条其他命令:
brew list # 列出当前安装的软件
brew search nodejs # 查询与 nodejs 相关的可用软件
brew info nodejs # 查询 nodejs 的安装信息
如果需要安装指定版本的软件,执行 brew search 查看有没有需要的版本
在 @ 后面指定版本号,例如 brew install thrift@0.9
brew services
brew services 是一个非常强大的工具,可以管理软件,进行停止、重启等
brew install elasticsearch # 安装 elasticsearch
brew services start elasticsearch # 启动 elasticsearch
brew services stop elasticsearch # 停止 elasticsearch
brew services restart elasticsearch # 重启 elasticsearch
brew services list # 列出当前的状态