尝试安装Rails(OSX)时出现权限错误 [英] Permission Error When Trying To Install Rails (OSX)
问题描述
我是编程新手,正在尝试在终端上安装滑轨.我一直在遵循一位朋友的指示,安装了xcode命令行工具,自制软件,git,rbenv,ruby-build,ruby gems,ruby和postgres.但是每当我尝试$ gem install rails时,我都会得到以下信息:
I am new to programming and am trying to get rails installed on my terminal. I have been following instructions from a friend, installing the xcode command line tools, homebrew, git, rbenv, ruby-build, ruby gems, ruby, and postgres. But whenever, I try $gem install rails, I get the following:
Russell-Silvers-MacBook-Pro:~ Russell_Silver$ gem install rails
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rails-4.2.0/README.md
这尤其令人沮丧,因为当我运行$ gem list时,它说我有rails 3.2.18.这很奇怪,因为当我运行$ rails v $时,它告诉我我有Rails 4.2.0.
This is especially frustrating because when I run $gem list, it says I have rails 3.2.18. Which is peculiar, because when I run $rails v$, it tells me I have Rails 4.2.0.
当我尝试使用导轨rails my new_app
Errno::EACCES: Permission denied @ rb_sysopen - /Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rails-4.2.0/README.md
An error occurred while installing rails (4.2.0), and Bundler cannot continue.
Make sure that `gem install rails -v '4.2.0'` succeeds before bundling.
run bundle exec spring binstub --all
/Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/shared_helpers.rb:83: warning: Insecure world writable dir /Users/Russell_Silver in PATH, mode 040707
bundler: command not found: spring
Install missing gem executables with `bundle install`
Russell-Silvers-MacBook-Pro:~ Russell_Silver$ bundle install
/Users/Russell_Silver/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.8.3/lib/bundler/vendor/thor/shell/basic.rb:355: warning: Insecure world writable dir /Users/Russell_Silver in PATH, mode 040707
Could not locate Gemfile or .bundle/ directory
这真的令人沮丧,尤其是对于像我这样的编程新手来说,所以我正在寻求可能知道哪里出问题的任何人的帮助.
This is really frustrating, especially for someone new to programming such as myself, so I am seeking help from anybody who might know what is wrong.
推荐答案
您的rbenv
安装未正确安装,因为它具有提升的特权,这导致您的用户帐户无权访问~/.rbenv
.
Your rbenv
installation was incorrectly installed as it had elevated privileges which caused your user account to not have write access to ~/.rbenv
.
发出以下命令以获取目录的所有权:
Issue the following command in order to take of ownership of the directory:
sudo chown -R Russell_Silver ~/.rbenv
请注意,某些用户可能具有不同的rbenv
目录,例如/usr/local/var/rbenv
.这将代替上述命令中的~/.rbenv
.
Note that some users may have a different rbenv
directory, e.g. /usr/local/var/rbenv
. This would take the place of ~/.rbenv
in the above command.
这篇关于尝试安装Rails(OSX)时出现权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!