0
点赞
收藏
分享

微信扫一扫

Mac安装brew

慎壹 2022-04-14 阅读 130
安全

HomeBrew简介

我们在使用Linux系统的时候,都很喜欢 (Debian/Ubuntu)系列的apt包管理系统和(Redhat/Fedora)系列的yum包管理系统。Mac OS X系统下面有apple的官方Mac App Store。但是好多软件是找不到的,所以我们也向在苹果下找到一款比较方便的包管理系统,就是Homebrew。

什么是Homebrew呢?Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with OS X. 官方的解释非常明了,Homebrew是一个包管理器,用于在Mac上安装一些OS X没有的UNIX工具(比如著名的wget),能在Mac中方便的安装软件或者卸载软件,可以说Homebrew就是mac下的apt-get、yum神器。

参考作者:Kandy
链接:https://www.jianshu.com/p/dff8c837b7dd
 

终端打开复制命令-直接下载-根据提示进行安装

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

brew 使用方法

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

常用命令

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

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.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

 

举报

相关推荐

0 条评论