安装brew
安装homebrew之前最好是执行以下语句:
git config --global http.postBuffer 542428800
否则的话很有可能会报错:
RPC failed; curl 18 transfer closed with outstandingreaddata remaining
然后执行安装命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果一不小心先执行安装命令了,安装过程可能会遇到以下报错
touch: /Users/mac/Library/Caches/Homebrew/.cleaned: Permission denied
Failed during: /usr/bin/touch /Users/mac/Library/Caches/Homebrew/.cleaned
遇到此问题,请把文件读写权限打开,可以使用以下命令:
1. sudo chmod 777 /Users/mac/Library/Caches/Homebrew/.cleaned
2. sudo chmod -R g+w /Users/mac/Library/Caches/Homebrew/.cleaned
但是其实用官网的下载地址会很慢很慢,如果网速快的话还能接受,所以可以采用国内镜像的方式下载,按照参考地址一步一步安装就行,不需要卸载homebrew。
步骤如下:
1. cd ~
2. curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
3. /usr/bin/ruby ~/brew_install
.........
具体步骤请参考:https://www.cnblogs.com/beyondmch/articles/8331478.html
直到看到 Install Successfully!的语句才算安装成功。
删除brew库
cd `brew --prefix`
$ rm -rf Cellar
$ brew prune
$ rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
$ rm -rf ~/Library/Caches/Homebrew
重装brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
原文:https://blog.csdn.net/itleaks/article/details/80366968
简单使用
安装软件:brew install 软件名,例:brew install wget
搜索软件:brew search 软件名,例:brew search wget
卸载软件:brew uninstall 软件名,例:brew uninstall wget
更新所有软件:brew update
更新具体软件:brew upgrade 软件名 ,例:brew upgrade git
显示已安装软件:brew list
查看软件信息:brew info/home 软件名 ,例:brew info git / brew home git
PS:brew home指令是用浏览器打开官方网页查看软件信息
查看哪些已安装的程序需要更新: brew outdated
显示包依赖:brew reps
显示帮助:brew help
参考博客:https://www.cnblogs.com/beyondmch/articles/8331478.html
homebrew官网:https://brew.sh/index_zh-cn
网友评论