![](https://i-blog.csdnimg.cn/blog_migrate/33e0c617c878563b1c1c22af2445b57a.png)
![](https://i-blog.csdnimg.cn/blog_migrate/ab9bab8d832943f70c01a8f66c12a918.png)
![](https://i-blog.csdnimg.cn/blog_migrate/d919ff8990ef929d7570d0afc3fd6d6f.png)
1. 全局安装 gulp:
$ npm install --global gulp
$ npm install --save-dev gulp
brew->nvm->node
brew 又叫Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便
brew类似ubuntu系统下的apt-get的功能
安装brew
brew 的官方网站: http://brew.sh/ 在官方网站对brew的用法进行了详细的描述
安装方法: 在Mac中打开Termal: 输入命令:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)” 注:此链接可能会根据官网变动
使用brew安装软件
一个命令就搞定了, 比如安装git
brew install git
比如安装wget
brew install wget
使用brew卸载软件
卸载更方便了
brew uninstall wget
![](https://i-blog.csdnimg.cn/blog_migrate/1b255d2c57938f0c9968588d27fd42b8.png)
其他brew命令
brew list 列出已安装的软件
brew update 更新brew
brew home 用浏览器打开brew的官方网站
brew info 显示软件信息
brew deps 显示包依赖
通过NVM安装指定版本的node
一. 安装NVM(前提是你安装了homebrew)
$ brew install nvm
二.在shell中可以使用nvm命令
如果没有.bash_profile文件需要自行touch .bash_profile哦
$ cd ~
$ vim .bash_profile
然后添加以下命令:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
然后重新source
$ source .bash_profile
三. 使用nvm安装node
$ nvm ls-remote 联网查看 所有的node可用版本
$ nvm install xxx 下载你想要的版本
$ nvm use xxx 使用指定版本的node
$ nvm alias default xxx 每次启动终端都使用该版本的node
四. 完成安装
$ node -v
$ npm -v