欢迎光临散文网 会员登陆 & 注册

在Linux中使用brew

2021-12-26 15:01 作者:beyondware  | 我要投稿

安装

1、安装依赖

sudo apt install build-essential procps curl file git

2、安装brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

删除brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

3、查看源

git -C "$(brew --repo)" remote -v

git -C "$(brew --repo homebrew/core)" remote -v

git -C "$(brew --repo homebrew/cask)" remote -v

4、替换源

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

brew update

还原源

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git

brew update

5、bottles替换源

bash用户

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

zsh用户

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc

source ~/.zshrc

常用命令

查看版本

brew -v

查看帮助

brew help

在浏览器打开官网

brew home 

验证brew能否正常

brew doctor

安装软件

brew install 软件名

卸载软件

brew uninstall 软件名

或者

brew remove 软件名

删除不需要的依赖

brew autoremove

查询软件

brew search 软件名

查看已安装软件列表

brew list 软件名

查看包信息

brew info [包名]

更新brew

brew update

更新所有[包名]

brew upgrade [包名]

查询可更新包

brew outdated

显示包依赖信息

brew deps [包名]

清理所有包的旧版本

brew cleanup 

清理指定包的旧版本

brew cleanup [包名]

查看可清理的旧版本包,不执行实际操作

brew cleanup -n 

后台运行

brew services start 软件名

brew services stop 软件名

brew services restart 软件名


在Linux中使用brew的评论 (共 条)

分享到微博请遵守国家法律