brew

Brew, also known as Homebrew, is a software package management tool on Mac OSX. It can easily install or uninstall software in Mac with only one command

Brew is similar to ubuntu apt-get

Installation: / usr/bin/ruby – e “$(curl – fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

  • Brew List lists installed software
  • Brew update Updates the BREW
  • Brew Home Open the official Brew web site with a browser
  • Brew Info Displays software information
  • Brew DEps shows package dependencies

Install the mongo

Brew install mongodb: No available formula with the name “mongodb”

Then you need to do the following:

  • brew services stop mongodb
  • brew uninstall mongodb
  • brew tap mongodb/brew
  • brew install mongodb-community
  • brew services start mongodb-community

Check the mongodb version: Mongo. Then enter mongod in the terminal, then enter mongo in the new terminal, the connection is successful.

The file path

Configuration file: / usr/local/etc/mongod. Conf log directory path: / usr/local/var/log/mongo data directory path: / usr/local/var/mongo

Start && Stop the mongodb-community server

Mongod runs as a service

brew services start mongodb-community brew services stop mongodb-community

Start Mongod manually

Mongod — config/usr/local/etc/mongod. Conf note: if you don’t include – config option, with a configuration file path is no default mongo server configuration file or log directory path, and will use the data/data/db directory path. To manually shutdown mongod, use the admin database and run db.shutdownServer() : mongo admin –eval “db.shutdownServer()”

Refer to the article

If you have any questions, please add my wechat id: 18231133236. Welcome to exchange! For more, please visit my personal blog: www.liugezhou.online. You can also follow my personal account: [Dangerous Wakaka]