首页 > 解决方案 > MacOS上安装mongodb时的问题

问题描述

我试图在我的 Mac 上安装 mongodb。但是出现了下面的错误信息。有人请告诉我解决方案。

Updating Homebrew...
==> Installing mongodb-community from mongodb/brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.4.1.tgz
Already downloaded: /Users/t17akeru/Library/Caches/Homebrew/downloads/d46781539dca95a7ced7d9b466b13bd4cc0202f17a8bf4bd499a5e1a4a241262--mongodb-macos-x86_64-4.4.1.tgz
Error: Failed to install plist file
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mongodb/brew/mongodb-community`
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
  brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
  mongod --config /usr/local/etc/mongod.conf
==> Summary
  /usr/local/Cellar/mongodb-community/4.4.1: 11 files, 136.8MB, built in 4 seconds
==> `brew cleanup` has not been run in 30 days, running now...
Error: Permission denied @ apply2files - /usr/local/share/5.2/luarocks/add.lua

标签: mongodb

解决方案


MongoDB 已正确安装。问题在于 plist 文件的安装(例如,它允许您在计算机启动时启动 MongoDB)。您仍然可以使用mongod --config /usr/local/etc/mongod.conf.

此外, brew 似乎有一些权限问题。以下是此 GitHub 问题的一些可能解决方案:

重新安装 Brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

在 /usr/local 中重置权限

sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*

然后,您可以尝试使用运行 MongoDB 的安装后脚本brew postinstall mongodb/brew/mongodb-community

希望它有所帮助!


推荐阅读