Homebrew官网:http://brew.sh

Homebrew installs the stuff you need that Apple didn't

Homebrew的安装非常简单,打开终端复制、粘贴以下命令。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.如果你当前的环境变量还没有加入 mongod ,手动添加的环境变量中.

$ nano ~/.bash_profile

//添加mongodb安装目录到环境变量中

export PATH=/usr/local/Cellar/mongodb/3.4.0/bin/:$PATH

 

3.如果让环境变量马上生效? 执行下面的

shell source ~/.bash_profile