在 Mac OS X 上卸载 MongoDB

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24547016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 13:45:54  来源:igfitidea点击:

Uninstall MongoDB on Mac OS X

mongodb

提问by jasenlew

When I try to run mongod from the terminal, I get the following error:

当我尝试从终端运行 mongod 时,出现以下错误:

2014-07-02T23:56:24.797-0700 [initandlisten] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017 2014-07-02T23:56:24.797-0700 [initandlisten] ERROR: addr already in use

2014-07-02T23:56:24.797-0700 [initandlisten] 错误:listen():bind() 失败 errno:48 地址已用于套接字:0.0.0.0:27017 2014-07-02T23:56:207.797 [initandlisten] 错误:地址已被使用

I recently realize that I have two versions of MongoDB on my Mac, and think this may be the source for the above error. (Plus, I do not need two version.) I tried Googling, but was not able to find clear directions on how I can uninstall. I have development version 2.7.0 AND 2.6.3.

我最近意识到我的 Mac 上有两个版本的 MongoDB,并认为这可能是上述错误的根源。(另外,我不需要两个版本。)我尝试使用谷歌搜索,但无法找到有关如何卸载的明确说明。我有 2.7.0 和 2.6.3 的开发版本。

Thanks so much in advance for the help!

非常感谢您的帮助!

回答by Anuvrat Tiku

Run the following commands to remove mongodb from the launch/startup and to uninstall it using Homebrew:

运行以下命令从启动/启动中删除 mongodb 并使用 Homebrew 卸载它:

# See if mongo is in the launch/startup list
launchctl list | grep mongo

# Remove mongodb from the launch/startup
launchctl remove homebrew.mxcl.mongodb

# Kill the mongod process just in case it's running
pkill -f mongod

# Now you can safely remove mongodb using Homebrew
brew uninstall mongodb

Just double-check in /usr/local/bin/to make sure that the mongodb commands are removed.

只需/usr/local/bin/再次检查以确保删除了 mongodb 命令。

回答by MaryBngozi

Nitin Jadhavversion worked for me, brew uninstall mongodbkept given me Error: No such keg: /usr/local/Cellar/mongodb. I was removing a mongodb-community. use cd /usr/local/Cellarthen run ls -aand then run rm -rf mongodb-communityto remove it

Nitin Jadhav版本对我有用brew uninstall mongodb一直给我Error: No such keg: /usr/local/Cellar/mongodb。我正在删除一个 mongodb 社区。使用cd /usr/local/Cellar然后运行ls -a然后运行rm -rf mongodb-community将其删除

回答by BritBarrick

I would suggest navigating into your /usr/local/Cellarand run an ls -a, I had a community version of mongo installed that wasn't being picked up by the command given above. If you find any mongo versions there just rm -rfeach instance

我建议导航到您的/usr/local/Cellar并运行一个ls -a,我安装了社区版本的 mongo,上面给出的命令没有选择该版本。如果您在rm -rf每个实例中找到任何 mongo 版本