由于很多开源的东西,苹果没有安装源,可以使用homebrew来管理安装,所以在osx下安装好homebrew还是很方便的。记录下。
- 查看版本
ruby -version
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
-e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError)
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 显示包依赖