brew 使用方法

2022-02-20 18:48 brew 使用方法已关闭评论

Homebrew安装:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

常用命令:

brew list             #列出已安装的软件
brew update      #更新brew
brew home        #用浏览器打开brew的官方网站
brew info           #显示软件信息
brew deps         #显示包依赖
brew upgrade    #更新某个具体软件
brew outdated   #查看那些包需要更新

示例:

搜索vim(此步骤非必须)
brew search vim
安装软件
brew install vim
卸载软件
brew uninstall vim
显示已经安装软件列表
brew list

卸载brew

cd `brew –prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -rf Library .git .gitignore bin/brew
rm -rfREADME.mdshare/man/man1/brew
rm -rf Library/Homebrew Library/Aliases
rm -rf Library/Formula Library/Contributions
rm -rf ~/Library/Caches/Homebrew

brew更新源

# 替换brew.git:
$ 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

重置更新源

# 重置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 使用方法 | DPIP知识库
分类:Mac 标签:

评论已关闭!