Blankman
Blankman

Reputation: 267230

Trying to upgrade mongodb 4.0 to 4.2 using homebrew

I installed mongodb using homebrew as you can see since I have a plist file. When I try and upgrade to 4.2 it doesnt' seem to recognize my installation.

I noticed mongodb now has a tap so I did install that but getting this error:

brew tap mongodb/brew

My plist file:

me$ cat ~/Library/LaunchAgents/homebrew.mxcl.mongodb.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>homebrew.mxcl.mongodb</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/opt/mongodb/bin/mongod</string>
    <string>--config</string>
    <string>/usr/local/etc/mongod.conf</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <false/>
  <key>WorkingDirectory</key>
  <string>/usr/local</string>
  <key>StandardErrorPath</key>
  <string>/usr/local/var/log/mongodb/output.log</string>
  <key>StandardOutPath</key>
  <string>/usr/local/var/log/mongodb/output.log</string>
  <key>HardResourceLimits</key>
  <dict>
    <key>NumberOfFiles</key>
    <integer>4096</integer>
  </dict>
  <key>SoftResourceLimits</key>
  <dict>
    <key>NumberOfFiles</key>
    <integer>4096</integer>
  </dict>
</dict>
</plist>
me$ brew info mongodb
Error: mongodb: unknown version :mountain_lion

I don't mind uninstalling it if I have too but since brew can't even recognize the installation there doesn't seem to be a clean way of doing this.

Is there something else I can try?

Upvotes: 1

Views: 1043

Answers (1)

Vijay Rajpurohit
Vijay Rajpurohit

Reputation: 1352

Firstly, uninstall the existing version of MongoDB with the following commands:

launchctl list | grep mongo 

launchctl remove homebrew.mxcl.mongodb 

pkill -f mongod 

brew uninstall mongodb

And just double-checks in /usr/local/bin/ to make sure that the MongoDB commands are removed.

Now to install [email protected]

Follow the instructions below:

brew tap mongodb/brew
brew install [email protected]

And once the installation is completed.

Start the service using:

brew services start [email protected]

For more refer to Official documentation.

Hope this will help :)

Upvotes: 2

Related Questions