Skip to content

2017-10-15 Installing MongoDB on macOS High Sierra

  • curl -O failed. File 200bytes!?
  • Downloaded via: instead
  • Unpacked into downloads, then realised this is much much easier via homebrew, which we have installed. So:
  • brew update (this takes a good 30 seconds)
  • brew install mongodb
  • Created a new folder under projects called mongo/data
  • Checked mongod is in path via which mongod
  • (reports /usr/local/bin/mongod, so homebrew did its thing fine
  • ls ~/Projects/mongo/data to check with have the right path for mongo data (we just created)

boom! 🙁

mongo ~/Projects/mongo/data
MongoDB shell version v3.4.9
connecting to: mongodb:///Users/shellbryson/Projects/mongo/data
2017-10-15T22:13:46.886+0100 E QUERY    [thread1] Error: Failed to parse mongodb:// URL: mongodb:///Users/shellbryson/Projects/mongo/data :
exception: connect failed
  • …failed because I forgot the dbpath param: mongod –dbpath
  • mongo --dbpath ~/Projects/mongo/data
  • Success!

Okay we now have MongoDB installed. Lets add some tools:

  • Registered and downloaded MongoDB Compass with default options. Ran it, and it connected fine.