MongoDB on startup for Mac OSX

Discussion in 'Server/Backend related tutorials' started by princess_affair, Oct 10, 2012.

  1. princess_affair

    princess_affair Level 1 Regular Member

    Here's the steps to start your MongoDB every time you switch on your Mac machine.

    Step1: Save the below contents into /Library/LaunchDaemons/org.mongo.mongod.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">
    Step2: Create the log file and DB directory

    sudo chown root:wheel /Library/LaunchDaemons/org.mongo.mongod.plist

    sudo touch /opt/local/var/log/mongodb.log
    sudo mkdir -p /opt/local/var/db/mongodb 

    Step3: Run the following commands in terminal to load the file into launchctl

    sudo launchctl load /Library/LaunchDaemons/org.mongo.mongod.plist 
    sudo launchctl start org.mongo.mongod
  2. This was such an amazing thread.

Share This Page