1. 程式人生 > >mac osx 下 homebrew安裝

mac osx 下 homebrew安裝

##前言
由於作者這個月什麼東西都沒寫,只能湊湊文字
由於很多開源的東西,蘋果沒有安裝源,可以使用homebrew來管理安裝,所以在osx下安裝好homebrew還是很方便的。記錄下。
##步驟
###1.檢視版本
輸入
ruby -version
輸出
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
###2.安裝homebrew
輸入
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


輸出
如果提示出錯了Error: /usr/local/Cellar is not writable. You should change the ownership and permissions of /usr/local/Cellar back to your user account:
輸入下面的命令列
sudo chown -R $(whoami) /usr/local/Cellar
然後繼續安裝輸入上面的安裝指令
###3.檢測是否安裝成功
brew
如果安裝成功了,會返回如下命令

Example usage: 
  brew search [TEXT|/REGEX/] 
  brew (info|home|options) [FORMULA…] 
  brew install FORMULA… 
  brew update 
  brew upgrade [FORMULA…] 
  brew uninstall FORMULA… 
  brew list [FORMULA…]

Troubleshooting: 
  brew config 
  brew doctor 
  brew install -vd FORMULA

Developers: 
  brew create [URL [–no-fetch]] 
  brew edit [FORMULA…] 
  https://docs.brew.sh/Formula-Cookbook.html

Further help: 
  man brew 
  brew help [COMMAND] 
  brew home

###4.使用brew來安裝node
brew install node
如果提示

Error: The brew link step did not complete successfully 
The formula built, but is not symlinked into /usr/local 
Could not symlink . 
/usr/local/opt is not writable.

更新許可權,然後再去連結一下
sudo chown -R $(whoami) /usr/local
brew link node

安裝ios-deploy
npm install -g ios-deploy


如果安裝出錯了

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib 
  Referenced from: /usr/local/bin/node 
  Reason: image not found 
Abort trap: 6 

安裝一下 icu4c, 然後link一下

brew install icu4c
brew link icu4c

###5 brew其它命令

命令 說明
brew list 列出已安裝的軟體
brew update 更新brew
brew home 用瀏覽器開啟brew的官方網站
brew info 顯示軟體資訊
brew deps 顯示包依賴

本文參考自<<