Mac OS安装mongodb

1.使用Homebrew软件包管理工具安装

brew 又叫Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装或者卸载软件,类似于ubuntu系统下的apt-get

  • 如果你的系统中尚未安装Homebrew,那就先装好Homebrew:
    在终端输入如下命令即可
    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

  • 装好brew后先对它进行更新
    brew update

  • 接下来开始安装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

  • 输入 brew services start mongodb 启动mongodb,如果启动成功,就会提示如下信息:

Successfully started mongodb (label: homebrew.mxcl.mongodb)

  • 最后,输入mongo进入mongodb,提示如下信息就表示一切顺利~

MongoDB shell version: 3.2.11
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type “help”.
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user

    原文作者:繁著
    原文地址: https://www.jianshu.com/p/ccac2c9bc02a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞