Question

I'm trying to run "bundle install" to install required gems for my rails project. Previously this wasn't an issue - this is a new machine I'm now working on... I've just been installing ruby (1.9.3 545) rails etc. and now at the point of the bundle install.

Some sample output is below (some gemspecs snipped out to keep this quote short!):

[shall@mars2-stream14 QA_Web]$ bundle install
/usr/local/lib/ruby/1.9.1/yaml.rb:84:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Using rake 10.2.2
Using i18n 0.6.9
Installing json 1.8.1

Errno::EACCES: Permission denied - /usr/local/lib/ruby/gems/1.9.1/specifications/json-1.8.1.gemspec
An error occurred while installing minitest (5.3.2), and Bundler cannot continue.
Make sure that `gem install minitest -v '5.3.2'` succeeds before bundling.
[shall@mars2-stream14 QA_Web]$ ls -l /usr/local/lib/ruby/gems/1.9.1/specifications/
total 44
-rw-r--r-- 1 root root  154 Apr 14 11:05 bigdecimal-1.1.0.gemspec
-rw-r--r-- 1 root root  142 Apr 14 11:05 json-1.5.5.gemspec
-rw------- 1 root root 1355 Apr 14 12:55 json-1.8.1.gemspec
-rw-r--r-- 1 root root  150 Apr 14 11:05 minitest-2.5.1.gemspec
-rw-r--r-- 1 root root  154 Apr 14 11:05 rdoc-3.9.5.gemspec

Clearly (or at least, as I understand it) bundler is sudoing to create the gemspec files - but creating them with 600 permissions - then trying to read these files for subsequent installs - and failing. I can sudo chmod 644 the files... then try again to get the next step - but this cannot be right?

Anyone care to suggest why the files are installed 600 by bundler?

I've seen similar issues on SO - but they all seem to be relating to folder permissions, and not being able to CREATE a file. I can create them - I just can't read them afterwards!

Thanks!

Was it helpful?

Solution 2

Issue found!

What I wasn't told when SysAdmin built the new box, was a new umask policy had been implemented, effectively "locking down" most files - including the gemspecs!

When I pointed out the problem this caused, the policy was reverted (at least for my machine!) - and bundle install ran like the proverbial charm!

So while this answer may seem specific to my scenario - to make it more SO friendly, and to help anyone else in future - if you get a similar permission problem to me as defined above - look into the umask settings on your environment. :)

OTHER TIPS

You need to pay attention on this line

Make sure that `gem install minitest -v '5.3.2'` succeeds before bundling

So install this gem first, run this command

gem install minitest -v '5.3.2'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top