Ruby 2.3.0 gem pg版本0.18.4安装错误El Capitan

Ruby 2.3.0 gem pg版本0.18.4安装错误El Capitan,ruby,macos,postgresql,rubygems,Ruby,Macos,Postgresql,Rubygems,在“bundle安装”之后,我多次遇到这个错误 Errno::EACCES: Permission denied @ rb_sysopen - /Users/daisukeishii/tasca- io/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4/.gemtest An error occurred while installing pg (0.18.4), and Bundler cannot continue. Make sure that `g

在“bundle安装”之后,我多次遇到这个错误

Errno::EACCES: Permission denied @ rb_sysopen - /Users/daisukeishii/tasca-     io/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4/.gemtest

An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
  • gem install pg
    不断给出相同的错误 -ruby 2.3.0p0(2015-12-25修订版53290)[x86_64-darwin15] -psql(PostgreSQL)9.5.0 -麦卡皮坦酒店 -我检查了stackoverflow中的所有相关帖子,但无法解决此问题
  • 试图通过brew卸载/安装PostgreSQL
  • 试图卸载/安装Ruby

你有什么办法解决这个问题吗?

我在安装pg gem时遇到了问题,对我来说,这就解决了问题:

ARCHFLAGS="-arch x86_64" gem install pg
但是,查看错误消息,实际上似乎是关于没有对gem目录的写入权限。也许您尝试使用
sudogem install pg
以root用户身份安装gem,但它在主目录下留下了一个目录,其中root用户而不是普通用户

使用以下命令删除目录:

sudo rm -rf /Users/daisukeishii/tascaio/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4
然后使用上面的
ARCHFLAGS
再次尝试安装


请注意,您的帖子在路径中存在某种复制粘贴问题,因此本例中的路径可能不正确。

在我的情况下,
pg
gem在错误的位置查找PostgreSQL安装,因此我运行了

bundle config build.pg——带pg config=/usr/local/cillar/postgresql/9.4.5/bin/pg\u config

这就是我安装PostgreSQL的地方,然后

bundle安装