0
votes

As title

git:(master) ✗ gem install rails ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.4.0/gems/rails-5.1.4/README.md

git:(master) ✗ sudo gem install rails Successfully installed rails-5.1.4 Parsing documentation for rails-5.1.4 Done installing documentation for rails after 0 seconds 1 gem installed

~ git:(master) ✗ rails -v Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.

1
did you run sudo gem install rails? what OS ? - Luis Menjivar
my os is OSX yes, after sudo gem install rails >>>Successfully installed rails-5.1.4 Parsing documentation for rails-5.1.4 Done installing documentation for rails after 0 seconds 1 gem installed but if i check the version of rails it shows Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your "rails" command. - 曾濟彬
my os is OSX yes, after sudo gem install rails >>>Successfully installed rails-5.1.4 Parsing documentation for rails-5.1.4 Done installing documentation for rails after 0 seconds 1 gem installed but if i check the version of rails it shows Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your "rails" command. - 曾濟彬
What Ruby version are you using if you are using a ruby version manager? - Luis Menjivar
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16] - 曾濟彬

1 Answers

1
votes

I would recommend you to use:

  1. rbenv for ruby installation

  2. and only with it use gem install rails

Usually installing gems with sudo is a bad idea, that brings a lot of problems with permissions.