Skip to content

Instantly share code, notes, and snippets.

@netshade
Last active May 10, 2022 16:24
Installing Mongo DB 2.6 on Big Sur
  1. Download MongoDB for Mac OS
  2. Extract the contents of the tgz file to /usr/local/mongo ( or wherever )
  3. Create a new launch plist with the following content at /Library/LaunchDaemons/com.mongo.db.plist (take note that you will need to change the User Name value in the below plist):
<?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>com.mongo.db</string>
    <key>UserName</key>
    <string>THE USER YOU WANT IT TO RUN AS</string>
    <key>SessionCreate</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/mongo/bin/mongod</string>
      <string>--master</string>
      <string>--logpath</string>
      <string>/usr/local/mongo/log/mongo.log</string>
      <string>--dbpath</string>
      <string>/usr/local/mongo/data</string>
    </array>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/usr/local/mongo/log/stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/usr/local/mongo/log/error.log</string>
  </dict>
</plist>
  1. Load the server via sudo launchctl load /Library/LaunchDaemons/com.mongo.db.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment