I somehow messed my $PATH up. (changed it) and my ruby and rails gems weren't working. What I did in efforts to fix this was to reinstall RVM. Now my ruby works fine in the Terminal.
On running gem install rails
I get greeted with this:
Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
When I try to install rails through sudo gem install rails
, I get this error:
ERROR: While executing gem ... (Errno::EACCES)
I have XCode installed with Command-Line tools installed as well. Even went ahead to install GCC but get the very same error when I try to install rails.
This is the full error message
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
emmanuels-imac:~ siaW$ sudo gem install rails
Password:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:24:in `<main>'
Gem files will remain installed in /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13 for inspection.
Results logged to /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13/ext/gem_make.out
I am the admin of my computer and running Mac OS 10.8.3. I'd appreciate some help with the rails install.
EDIT:
Thanks @Christoph
The only code that helped was to actually remove the RVM folder with
sudo rm -rf ~/.rvm/
I tried only to uninstal and it didn't work. So removing the folder and then reinstalling RVM does the job.
Like Dave pointed out up there, there should be no need to sudo any Gem installation. You could try to reset the permissions on your RVM directory:
sudo chown -R emKaro: ~/.rvm/
and try your Gem instllation again. If that doesn't work out, you should consider removing your RVM installation and start over:
sudo rm -rf ~/.rvm/ # remove your RVM directory
There should really be no need for using sudo in any of this.
I'm running 10.8.5 OSX and was trying to install Rails with Ruby 1.9.3-p448 - so I don't know if it's exactly the same problem, but by looking in the mkmf.rb code where it failed, I found that the problem was that the basic CC command wasn't running. For some reason, it needed to search for the folders in /usr/local, and for some reason, /usr/local was set to 740 permissions on my install (which I had gotten from someone else so not sure what he had done prior to my getting the machine.)
So after I did chmod +x /usr/local
, everything worked ok.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With