简体   繁体   中英

Ruby 2.3.0 gem pg version 0.18.4 install error El Capitan

After "bundle install", I keep getting this error for many times.

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 keeps giving the same error -ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15] -psql (PostgreSQL) 9.5.0 -Mac El Capitan -I checked all related posts in stackoverflow but could not solve this.
  • Tried to uninstall/install PostgreSQL through brew.
  • Tried to uninstall/install Ruby

Do you have any idea to solve this?

I had problems installing the pg gem and for me this did the trick:

ARCHFLAGS="-arch x86_64" gem install pg

However, looking at your error message it actually seems to be about not having write permissions to the gem directory. Maybe you have tried to install the gem as root with sudo gem install pg and it left behind a directory under your home directory having root as owner instead of your regular user.

Remove the directory using:

sudo rm -rf /Users/daisukeishii/tascaio/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4

And then try installing again using the ARCHFLAGS above.

Note that your post has some sort of copy paste problem in the path so the path in this example might not be correct.

In my case, the pg gem was looking for a PostgreSQL installation in the wrong place, so I runned

bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.4.5/bin/pg_config

which was where my PostgreSQL installation actually was, and then

bundle install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM