I've followed the directions on the MongoDB docs to install MongoDB on Mac using homebrew:
brew tap mongodb/brew
brew install [email protected]
Then I can run it in the foreground using:
mongod --config /usr/local/etc/mongod.conf
But, when trying to start it as a service using:
brew services start [email protected]
I get this error:
Error: mongodb-community: uninitialized constant #<Class:0x00007ff189061008>::Gem
I also get this error when running brew doctor
:
Warning: Some installed formulae are not readable:
mongodb-community: uninitialized constant #<Class:0x00007ffd903152a0>::Gem
Why this is happening? How do I fix it?
Thank you!
This is an error with the mongodb-community formula. An issue has been filed with the maintainers, a solution found, and a pull request with the fix opened.
In the meantime, you can fix the error yourself. This line in the formula is throwing an exception:
Gem::Version.new(v['version'])
because the Gem class has not been imported. Adding the import:
require 'rubygems'
solves the problem. You can do this locally, by finding and editing the formula on your computer. It is probably in this file:
/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew/Formula/mongodb-community.rb
Update: A community contributor has fixed this upstream. If you are still experiencing this issue you might need to run brew update
I know it's not correct answer since we are talking about registering service using:
brew services start mongodb-community
But I've SOLVED service registration question this way:
sudo cp /usr/local/Cellar/mongodb-community/4.0.9/homebrew.mxcl.mongodb-community.plist /Library/LaunchAgents/
launchctl load -w /Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
launchctl start mongodb-community
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With