brew search mongodb查找可以安装的版本。
试了几个发现可以用brew 安装[email protected]。于是成功安装了。
装了之后就需要配置路径,网上也是教程很多,语句又都不一样。都说用brew安装会有默认路径,但是我发现我的不是默认的安装路径。用
brew info [email protected]
这个命令可以查看到很多相关信息。终端出现一大堆文字如图
[email protected]: stable 3.4.14 (bottled) [keg-only]
High-performance, schema-free, document-oriented database
https://www.mongodb.org/
/usr/local/Cellar/[email protected]/3.4.14 (19 files, 296MB)
Poured from bottle on 2018-07-02 at 20:39:00
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]
==> Dependencies
Build: go ✘, scons ✘
Recommended: openssl ✔
Optional: boost ✘
==> Requirements
Required: macOS >= 10.8 ✔
==> Options
--with-boost
Compile using installed boost, not the version shipped with mongodb
--with-sasl
Compile with SASL support
--without-openssl
Build without openssl support
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
To have launchd start [email protected] now and restart at login:
brew services start [email protected]
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
bogon:~ lijuan$
配置路径我直接用了echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
然后用语句brew services start [email protected]来启动。
再之后直接输入 mongo就可以进入shell
mongoexport就可以导出,说明前面路径配置已经成功。
我安装了Robo 3T来当图形化界面,点击了Conection,反正第一次出不来就多点击几次,然后连接上了mongodb.