0

I'm now using macbook terminal to study rails. I'm trying to install ruby on rails so I got homebrew and rbenv. And I entered "gem install rails" to get rails but he said

"ERROR: Loading command: install (LoadError) cannot load such file -- openssl ERROR: While executing gem ... (NoMethodError) undefined method `invoke_with_build_args' for nil:NilClass"

I have no idea with this error because i usually use windows.. I thought that gem installed uncompletely so i tried to reinstall gem, but i couldn't even find how to reinstall this. plz help me..

Jonathan Argentiero
  • 5,687
  • 8
  • 29
  • 34
Minseok Song
  • 23
  • 1
  • 1
  • 3
  • Please run the following and update your question with the results: **Ruby Version:** `ruby -v`; **Rubygems version:** `gem --version`; – ashmaroli Mar 15 '17 at 01:56
  • ruby -v : ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin14.0.0] // gem --version : 2.0.14.1 this is my result. – Minseok Song Mar 21 '17 at 03:30

1 Answers1

2

The latest version of Ruby is 2.4.0, and the latest version of Rubygems, is 2.6.11

While its not necessary that you need to use the latest version of Ruby itself, (Note: Rails 4.x is compatible with your version, but Rails 5.x isn't), updating the Rubygems version should help. To update Rubygems version simply run

$ gem update --system

--- UPDATE: ---

If that doesn't work, you can install the latest version of Rubygems manually at https://rubygems.org/pages/download

ashmaroli
  • 5,209
  • 2
  • 14
  • 25
  • Thanks for your answer. but the result is similar with that,, ERROR : Loading command : update (LoadError) // I think there is some problem with my gem.. – Minseok Song Mar 21 '17 at 09:20
  • updated answer with a link to manually download latest version of Rubygems. – ashmaroli Mar 21 '17 at 14:40
  • wow thanks. i think gem is correctly reinstalled but another problem arose. After reinstall gem, i retried "gem install rails" but he said "Error installing rails : activesupport requires ruby versions >= 2.2.2." So I tried to update my ruby by rbenv, and the command "rbenv version" results is "2.3.3 (set by /usr/local/bin/.ruby-version)". But when i tried "ruby -v", the result is "ruby 2.0.0p648 ~~~~~". And of course "gem install rails" result is same with first try. I don't know what's wrong with this. – Minseok Song Mar 22 '17 at 07:33
  • after you update ruby version via `rbenv`, you need to make it the default version. Run **`$ rbenv local 2.3.3`** for the current user account and if you have top level access, **`$ rbenv global 2.3.3`** to make it the default for all users on the system. – ashmaroli Mar 22 '17 at 12:55
  • I already did "rbenv global 2.3.3" and "rbenv local 2.3.3". And the result of both of "rbenv global" and "rbenv local" are "2.3.3". But result of "ruby -v" is "2.0.0." – Minseok Song Mar 23 '17 at 09:22
  • refer [this thread](http://stackoverflow.com/questions/10940736/rbenv-not-changing-ruby-version) for possible solutions to current problem. – ashmaroli Mar 23 '17 at 11:08
  • Thanks!! Finally I installed rails in my mac. As I have a poor ability of english, I can't express my appreciation more than this. Thank you very much! – Minseok Song Mar 28 '17 at 04:24