How to install MongoDB on MAC with Yosemite OS

Here is quick guide to install [easyazon_link identifier=”1449344682″ locale=”US” tag=”wn0d5-20″]MongoDB[/easyazon_link] on your MAC running Yosemite OS. There are two easy ways to accomplish this task:

  1. Manually, through the official binaries
  2. Through Homebrew package manager for Mac OS

Installing [easyazon_link identifier=”148420896X” locale=”US” tag=”wn0d5-20″]MongoDB[/easyazon_link] with Homebrew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
$ brew install mongodb
-- Note that you can install these additional options
//Install with Open SSL support
$ brew install mongodb --with-openssl
//Install from the last available development release (not recommended for Production Environments)
$ brew install mongodb --devel

Now you have installed the [easyazon_link identifier=”1617291609″ locale=”US” tag=”wn0d5-20″]MongoDB[/easyazon_link] on your MAC system. Install MongoDB manually follow up these steps:

curl -O http://downloads.mongodb.org/osx/mongodb-osx-x86_64-3.0.3.tgz
tar -zxvf mongodb-osx-x86_64-3.0.3.tgz
mkdir -p mongodb
cp -R -n mongodb-osx-x86_64-3.0.3/ mongodb

Make sure that binaries are in your PATH, you can modify your PATH – you can add the following line to your shell’s rc file (~/.bashrc)

export PATH=mongodb-install-directory/bin:$PATH
-- where mongodb-install-directory is your path on your system

Before you start MongoDB for the first time, create the directory to which the mongod process will write data. By default, the mongod process uses the /data/db directory. If you create a directory other than this one, you must specify that directory in the dbpath option when starting the mongod process later in this procedure.
The following example command creates the default /data/db directory:

$ mkdir -p /data/db

Before you can run mongodb make sure as last thing that the user account running MongoDB has READ and WRITE permissions for the directory. To start MongoDB is very simple command:

$ mongod
MongoDB starting : pid=34022 port=27017 dbpath=/data/db/ 64-bit host=cloudman.local
//...
waiting for connections on port 27017

If you are interested Udemy has excellent course as well as you can take FREE certificate course at MongoDB University or you can buy this good Guide book at Amazon:

[easyazon_image align=”none” height=”160″ identifier=”1449344682″ locale=”US” src=”http://blog.technotesdesk.com/wp-content/uploads/2015/05/51gzqnIpxQL._SL160_.jpg” tag=”wn0d5-20″ width=”123″]

Leave a Reply