1

I am using Rails 4. Bundle was working up until yesterday, when I had to reinstall Bundler because of a different error. Now, when I run "bundle install", a few gems are successfully installed and then I receive this error message:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby -r ./siteconf20150509-3462-k6ug3q.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json-    1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-   10/2.0.0-static/json-1.8.2/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.

I then try to 'gem install json -v '1.8.2' and get this error message:

Building native extensions.  This could take a while...
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:73: warning:     
Insecure world writable dir /usr/local/lib/ruby/gems/2.0.0 in PATH, mode 040777
ERROR:  Error installing json:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby -r ./siteconf20150509-3898-12pmbxe.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json-1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-    10/2.0.0-static/json-1.8.2/gem_make.out

I have no idea how to fix this. I have tried several solutions including:

-"rvm implode"

-"sudo gem update --system"

-"sudo gem update --system --no-user-install"

-"sudo chmod 755 /usr/local/lib/ruby/gems/2.0.0/gems"

-"xcode-select --install"

-running Disk Repair

I read a few things about making changes to the path and bash profile, but I am unclear on how to do that.

Thank you in advance! Already spent 2 hours trying to solve this.

Morgan
  • 11
  • 1
  • 3

2 Answers2

0

Answered in this stack question : Insecure world writable dir /Users/username in PATH, mode 040777 when running Ruby commands

Your home folder should only be writable by you, not by anyone else. The reason gem is complaining about this is that you have folders in your PATH that are inside your (insecure) home folder, and that means that anyone who wants to could hack you by renaming/moving your .rvm folder and replacing it with an impostor.

To fix your home folder, run chmod go-w /Users/kristoffer. If there are any other insecure folders on the way to anything in your PATH, you should fix them similarly.

BTW, the reason that Disk Utility didn't repair this is that it only repairs files installed as part of the OS (see Apple's KB article on the subject). There is an option to repair home folder permissions if you boot from the install DVD and run Password Reset from the Utilities menu, but I'm not sure if it resets the permissions themselves or just ownership.

Community
  • 1
  • 1
Rots
  • 5,506
  • 3
  • 43
  • 51
  • This does not fix the problem. After doing such, I get this error: 'ERROR: While executing gem ... (Errno::EACCES) Permission denied - /usr/local/lib/ruby/gems/2.0.0/gems/json-1.8.2/tests/test_json.rb ' – Morgan May 09 '15 at 23:17
  • http://stackoverflow.com/questions/19572469/errnoeacces-permission-denied-when-running-bundle-and-it-hits-json-1-8-1-pg – Rots May 09 '15 at 23:22
  • How about the xcode console tools as per link above – Rots May 09 '15 at 23:27
  • Yes, this is the message after I run the command: `xcode-select: error: command line tools are already installed, use "Software Update" to install updates` – Morgan May 09 '15 at 23:28
  • Try searching around other stack questions – Rots May 09 '15 at 23:34
  • That's what I've been doing and have yet to find a solution that works, hence why I posted here. Thanks for trying to help though. – Morgan May 09 '15 at 23:36
  • No problem , I'm on the move now but if you don't find an answer ill take a look later on – Rots May 09 '15 at 23:39
0

Update

Installing a new version of Ruby seemed to work. Previously I was using 2.0.0, and now I upgraded to 2.2.2. This seems to have made the issue go away.

Morgan
  • 11
  • 1
  • 3