Permission error while trying to install Rails (OSX)

I am new to programming and trying to set rails on my terminal. I followed instructions from a friend by installing the xcode, homebrew, git, rbenv, ruby-build, ruby โ€‹โ€‹gems, ruby โ€‹โ€‹and postgres command line tools. But whenever I try to install the gem installation 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 

This is especially unpleasant because when I run the $ gem list, it says that I have rails 3.2.18. Which is characteristic, because when I run $ rails v $, it tells me that I have Rails 4.2.0.

When I try to use 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 

This is really frustrating, especially for someone new to programming, such as myself, so I'm looking for help from anyone who may know what is wrong.

+6
source share
1 answer

Your rbenv installation was not installed correctly, as it had elevated privileges, which prevented your user account from writing to ~/.rbenv .

Run the following command to get ownership of the directory:

  sudo chown -R Russell_Silver ~/.rbenv 

Note that some users may have a different rbenv directory, for example. /usr/local/var/rbenv . This will replace ~/.rbenv in the command above.

+34
source

Source: https://habr.com/ru/post/983295/


All Articles