使用 Homebrew 安装 mongodb
brew install mongodb
安装成功以后显示,在前/后台运行的方式
To have launchd start mongodb now and restart at login:
brew services start mongodb
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf