尝试安装时出现权限错误 Rails (OSX)
Permission Error When Trying To Install Rails (OSX)
我是编程新手,正在尝试在我的终端上安装 rails。我一直在按照朋友的指示安装 xcode 命令行工具、自制软件、git、rbenv、ruby-build、ruby gems, ruby,和 postgres。但是每当我尝试 $gem install rails 时,我都会得到以下信息:
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 列表时,它说我有 rails 3.2.18。这很奇怪,因为当我 运行 $rails v$ 时,它告诉我我有 Rails 4.2.0.
当我尝试使用 rails 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
这真的很令人沮丧,尤其是对于像我这样的编程新手,所以我正在寻求任何可能知道问题所在的人的帮助。
您的 rbenv
安装不正确,因为它具有提升的权限,导致您的用户帐户没有对 ~/.rbenv
.
的写入权限
发出以下命令以获得目录的所有权:
sudo chown -R Russell_Silver ~/.rbenv
请注意,某些用户可能有不同的 rbenv
目录,例如/usr/local/var/rbenv
。这将取代上述命令中的 ~/.rbenv
。
我是编程新手,正在尝试在我的终端上安装 rails。我一直在按照朋友的指示安装 xcode 命令行工具、自制软件、git、rbenv、ruby-build、ruby gems, ruby,和 postgres。但是每当我尝试 $gem install rails 时,我都会得到以下信息:
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 列表时,它说我有 rails 3.2.18。这很奇怪,因为当我 运行 $rails v$ 时,它告诉我我有 Rails 4.2.0.
当我尝试使用 rails 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
这真的很令人沮丧,尤其是对于像我这样的编程新手,所以我正在寻求任何可能知道问题所在的人的帮助。
您的 rbenv
安装不正确,因为它具有提升的权限,导致您的用户帐户没有对 ~/.rbenv
.
发出以下命令以获得目录的所有权:
sudo chown -R Russell_Silver ~/.rbenv
请注意,某些用户可能有不同的 rbenv
目录,例如/usr/local/var/rbenv
。这将取代上述命令中的 ~/.rbenv
。