ruby-on-rails – gem install rails错误:执行gem时…(Errno :: EACCES)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – gem install rails错误:执行gem时…(Errno :: EACCES)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我以某种方式搞砸了我的$PATH. (改变了)我的ruby和铁轨宝石不起作用.我在解决这个问题上所做的是重新安装RVM.现在我的ruby在航站楼工作​​得很好.
在运行gem install rails时我会遇到这样的问题:

许可被拒绝 – /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb

当我尝试通过sudo gem install rails安装rails时,我收到此错误

ERROR: While executing gem … (Errno::EACCES)

我安装了XCode并安装了Command-Line工具.甚至继续安装GCC但在我尝试安装rails时遇到了同样的错误.

这是完整的错误消息

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

我是我的电脑管理员并运行Mac OS 10.8.3.我很感激rails安装的一些帮助.

编辑:
谢谢@Christoph
唯一有用的代码是实际删除RVM文件
sudo rm -rf~ / .rvm /
我只尝试卸载它没有用.因此,删除文件夹,然后重新安装RVM就可以完成这项工作.

解决方法

就像Dave在那里指出的那样,不需要sudo任何Gem安装.您可以尝试重置RVM目录的权限:
sudo chown -R emKaro: ~/.rvm/

并再次尝试你的宝石安置.如果这不成功,您应该考虑删除RVM安装并重新开始:

sudo rm -rf ~/.rvm/   # remove your RVM directory

在任何一个中都不应该使用sudo.

猜你在找的Ruby相关文章