Mac系統下安裝/卸載brew(帶踩坑)

Homebrew是一個包管理器,用於在Mac上安裝一些OSX上沒有的UNIX工具(比如wget)。

  • 安裝brew,打開終端,複製粘貼,大約1分鐘左右,下載完成,過程中需要輸入密碼,其他無需任何操作:
/usr/bin/ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))"
  • 卸載brew,打開終端,複製粘貼:
/usr/bin/ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/uninstall](https://raw.githubusercontent.com/Homebrew/install/master/uninstall))"
  • brew的常規使用操作:
安裝軟件,如:brew install oclint
卸載軟件,如:brew uninstall oclint
搜索軟件,如:brew search oclint
更新軟件,如:brew upgrade oclint
查看安裝列表, 如:brew list
更新Homebrew,如:brew update
使用brew安裝wget:
brew install wget

祕籍一:使用wget更新hosts

wget [https://raw.githubusercontent.com/racaljk/hosts/master/hosts](https://raw.githubusercontent.com/racaljk/hosts/master/hosts) -qO /tmp/hosts && sudo sh -c 'cat /tmp/hosts > /etc/hosts'

參考鏈接:https://www.jianshu.com/p/5ef630c93cdb

安裝完後,查看版本發現,居然提示我:-bash:brew:command not found
然後我開始了瘋狂百度找答案,我就是按照教程安裝的啊!怎麼怎麼會有問題?

最後我終於在CSDN裏面找到了答案(這裏不是打廣告哈哈),下面就分享解決辦法,快拿去快拿去

  • 有一個homebrew國內自動安裝腳本https://gitee.com/cunkai/HomebrewCN
  • 在Mac os終端中複製粘貼回車下面這句話,然後我選擇的序列號是中科大的。
 /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
  • 現在我們可以用brew安裝我們想安裝的東西啦,比如我想安裝docker
$ brew cask install docker
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章