Install MongoDB under Mac
First, use a browser or a third-party tool to download
the download address of the current version: http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.6.tgz
Or the second, open a terminal and use the following command line to download:
curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.6.tgz > mongodb.tgz
After the installation is successful, the “mongod”
command starts the mongo
database. Enter http://127.0.0.1:28017 in the browser. If mongo
the database information can be displayed normally, it means the startup is successful.
The interface after success:
installation steps
1. First enter in the terminal ls
, list the directory, find your mongodb
file, tgz
end with
2. Open the terminal and enter tar -zxvf mongodb-osx-x86_64-2.4.6
, of course, the respective version numbers are correct.
3. Move the unzipped installation files to your preferred location:
mv -n ~/Downloads/mongodb-osx-x86_64-2.4.6 ~/Applications/mongodb/
My decompression directory is , the folder Downloads
moved to by default is invisibleApplications
mongodb
4. Create a directory under the root directory / data/db
for placing mongodb
data and set permissions for the directory
sudo mkdir -p /data/db
sudo chown -R trigkit4 /data
5. Start the mongodb
service
Open the terminal, type cd Applications/mongodb/bin
, press Enter, and then type./mongod
6. Open another terminal, enter Applications/mongodb/bin
, enter, enter ./mongo