Skip to content

Instantly share code, notes, and snippets.

@ivarprudnikov
Last active August 29, 2015 14:15
Show Gist options
  • Save ivarprudnikov/b613c23a3829b058b90c to your computer and use it in GitHub Desktop.
Save ivarprudnikov/b613c23a3829b058b90c to your computer and use it in GitHub Desktop.
OSX Mongodb setup

Mongodb on Mac OSX

Download/setup mongodb

  • curl -O http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.6.7.tgz
  • cd /usr/share
  • sudo mkdir mongodb
  • chown -Rv {username} mongodb
  • cd mongodb
  • tar -zxvf ~/Downloads/mongodb-osx-x86_64-2.6.7.tgz
  • ln -s mongodb-osx-x86_64-2.6.7/ current
  • mkdir -p data/db
  • cd current
  • vi mongod.conf Paste contents

Export path:

Add export PATH=/usr/share/mongodb/current/bin:$PATH to ~/.bash_profile

Launch agent

vi ~/Library/LaunchAgents/org.mongodb.mongod.agent.plist Paste contents

Logs

  • cd /var/log/
  • sudo mkdir mongodb
  • sudo chown -Rv {username} mongodb

================

On next login should launch mongodb

systemLog:
destination: file
path: "/var/log/mongodb/mongodb.log"
logAppend: true
storage:
journal:
enabled: true
net:
bindIp: 127.0.0.1
port: 27017
storage:
dbPath: "/usr/share/mongodb/data/db"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.mongodb.mongod</string>
<key>ProgramArguments</key>
<array>
<string>/usr/share/mongodb/current/bin/mongod</string>
<string>run</string>
<string>--config</string>
<string>/usr/share/mongodb/current/mongod.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>StandardErrorPath</key>
<string>/var/log/mongodb/mongodb.log</string>
<key>StandardOutPath</key>
<string>/var/log/mongodb/mongodb.log</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment