ITPub博客

首页 > 数据库 > > mac安装mongodb一路趟坑😢

mac安装mongodb一路趟坑😢

作者:浪花小雨滴 时间:2020-05-12 11:28:52 0 删除 编辑

从来没想到有一天会在mac上装环境装了2天,坑在了mongodb上,一路照着菜鸟教程从官网下载安装,结果改变环境变量那步直接蒙蔽,不知道咋操作

export PATH=/usr/local/mongodb/bin:$PATH

其实我现在也不知道咋搞,但是接下来就是一路坎坷,反正也解决不明白了

照着后面启动mongod的命令运行,却得到了一个Connection refused报错

 Error: couldn't connect to server 127.0.0.1:27017,
 connection attempt failed: SocketException:
 Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :

嗯,还是不懂,问了后台小伙伴,说服务器没起来,嗯,不懂

那就换个方法吧,不是还有brew安装么

然后还是一路坑!!!!

  • 报错1:
Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

解决:更新brew

brew update
  • 报错2:某个文件夹没有权限
The following directories are not writable by your user:
/usr/local/sbin

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/sbin

And make sure that your user has write permission.
  chmod u+w /usr/local/sbin

解决:授权后输入密码

sudo chown -R $(whoami) /usr/local/sbin
  • 报错3:这个是真的坑啊,xcode版本问题,appStore更新大半天,总是莫名其妙的中断了
Your Xcode (10.1) is too outdated.
Please update to Xcode 10.2.1 (or delete it).
Xcode can be updated from the App Store.

解决:简单点,成年人的世界简单点,直接应用程序里删除,重新安装

xcode-select --install
  • 报错4: 应该也是权限的问题,查了好久还用了brew doctor,结果被一堆waring吓到了
An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks

解决

sudo chown -R $(whoami) $(brew --prefix)/*
sudo install -d -o $(whoami) -g admin /usr/local/Frameworks

最后的最后安装成功了,一度想放弃了,最后找到了报错4的解决方案,果然XX大法好啊

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31537575/viewspace-3169455/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-05-16

  • 博文量
    4259
  • 访问量
    40093