- Install MongoDB >
- Install MongoDB on OS X
Install MongoDB on OS X¶
Starting in version 2.4, MongoDB only supports OS X versions 10.6 (Snow Leopard) on Intel x86-64 and later.
MongoDB is available through the popular OS X package manager Homebrew or through the MongoDB Download site.
Install MongoDB with Homebrew¶
In a terminal shell, use the following sequence of commands to update``brew`` to the latest packages and install MongoDB:
brew update brew install mongodb
Later, if you need to upgrade MongoDB, run the following sequence of commands to update the MongoDB installation on your system:
brew update brew upgrade mongodb
Optionally, you can choose to build MongoDB from source. Use the following command to build MongoDB with SSL support:
brew install mongodb --with-openssl
You can also install the latest development release of MongoDB for testing and development with the following command:
brew install mongodb --devel
|||Homebrew requires some initial setup and configuration. This configuration is beyond the scope of this document.|
Download the Latest Release¶
In a system shell, download the latest release for 64-bit OS X.
curl -O http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.9.tgz
You may optionally specify a different version to download.
Extract MongoDB From Archive¶
Extract the files from the downloaded archive.
tar -zxvf mongodb-osx-x86_64-2.4.9.tgz
Optional. Copy MongoDB to Target Directory¶
Copy the extracted folder into another location, such as mongodb.
mkdir -p mongodb cp -R -n mongodb-osx-x86_64-2.4.9/ mongodb
Optional. Configure Search Path¶
To ensure that the downloaded binaries are in your PATH, you can modify your PATH and/or create symbolic links to the MongoDB binaries in your /usr/local/bin directory (/usr/local/bin is already in your PATH). You can find the MongoDB binaries in the bin/ directory within the archive.
Set Up the Data Directory¶
You can specify an alternate path for data files using the --dbpath option to mongod. If you use an alternate location for your data directory, ensure that the alternate directory has the appropriate permissions.
For example, if your PATH includes the location of the mongod binary, enter mongod at the system prompt.
mongod --dbpath <some alternate directory>
Whether using the default /data/db/ or an alternate directory, ensure that the user account running mongod has read and write permissions to the directory.