Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB installed via Homebrew not working

I installed MongoDB via Homebrew (following http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) but it's not working.

Typing mongod at shell prompt gives me:

-bash: mongod: command not found

Not sure if I need to add something for Homebrew to my PATH env var?

I can see Mongo is installed under /usr/local/Cellar/mongodb – but am assuming I don't need to add everything I install via homebrew to the path? Also, assuming I can run mongod from any directory or am I actually meant to be in install directory?

When I run brew doctor I get:

Warning: You have unlinked kegs in your Cellar 

Followed by a list of 3 items which includes MongoDB – but I'm not sure how I'm meant to link them?

like image 597
webgirl Avatar asked Jul 29 '12 08:07

webgirl


2 Answers

Works perfectly

  1. brew update
  2. brew tap mongodb/brew
  3. brew install [email protected]

For latest version, check https://docs.mongodb.com/manual/release-notes/

like image 190
Den Avatar answered Sep 28 '22 07:09

Den


You're getting this error because your 'brew' install failed to create the correct symlinks in /usr/local/bin. As a result, the shell can't find the mongo executables in your $PATH. You can fix this using the following steps:

  • Check the permissions on /usr/local/bin and make sure that you own that directory and have write permissions on it

    $ ls -ld /usr/local/bin

  • Once you've fixed that, run 'brew link' to fix the symlinks

    $ brew link mongodb

like image 20
William Z Avatar answered Sep 28 '22 09:09

William Z