0

System: OSX 10.9.5, Rails 4.0.12

After cloning a repo for a demo app (Ruby 2.1.5, Rails 4.1.0), I used rvm to install and then switch to an older version of Ruby, so I could run the demo app. I had some issues running the demo app, so I went back to my main project app (Ruby 2.2.4, Rails 4.0.12), tried to run rails s and got:

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.

Well that's just silly. Rails was just here a moment ago. I tried switching gemsets within Ruby 2.2.4, even closing terminal in between, but still Rails was "not installed". These are my gemsets:

gemsets for ruby-2.0.0-p481 (found in /Users/localflavor/.rvm/gems/ruby-2.0.0-p481)
=> (default)
   global

gemsets for ruby-2.1.5 (found in /Users/localflavor/.rvm/gems/ruby-2.1.5)
=> (default)
   global

gemsets for ruby-2.2.1 (found in /Users/localflavor/.rvm/gems/ruby-2.2.1)
=> (default)
   global    

gemsets for ruby-2.2.2 (found in /Users/localflavor/.rvm/gems/ruby-2.2.2)
=> (default)
   global

gemsets for ruby-2.2.4 (found in /Users/localflavor/.rvm/gems/ruby-2.2.4)
=> (default)
   global

gemsets for ruby-2.3.0 (found in /Users/localflavor/.rvm/gems/ruby-2.3.0)
=> (default)
   global

The gems included in ruby2.2.4@default:

$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.2.6)
gem-wrappers (1.2.7)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (default: 2.0.8)
rake (default: 10.4.2)
rdoc (default: 4.2.0)
rvm (1.11.3.9)
test-unit (3.0.8)

The gems included in ruby-2.2.4@global

$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.2.6)
gem-wrappers (1.2.7)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (default: 2.0.8)
rake (default: 10.4.2)
rdoc (default: 4.2.0)
rvm (1.11.3.9)
test-unit (3.0.8)

Rails, where are you? I've tried rvm get master, reinstalling ruby 2.2.4, openssl, and bundler. I've tried every solution that seemed relevant from this SO question. All of this to no avail.

Interestingly enough, I am also unable to install the latest version of Ruby (2.4.0).

$ rvm install ruby 2.4.0
ruby-2.4.0 - #removing src/ruby-2.4.0..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-2.4.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/localflavor/.rvm/rubies/ruby-2.4.0, this may take a while depending on your cpu(s)...
ruby-2.4.0 - #downloading ruby-2.4.0, this may take a while depending on your connection...
ruby-2.4.0 - #extracting ruby-2.4.0 to /Users/localflavor/.rvm/src/ruby-2.4.0....
ruby-2.4.0 - #configuring...................................................................
ruby-2.4.0 - #post-configuration.
ruby-2.4.0 - #compiling....................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/localflavor/.rvm/log/1487187741_ruby-2.4.0/make.log
configuring pty
configuring racc/cparse
configuring rbconfig/sizeof
configuring readline
configuring ripper
configuring rubyvm
configuring sdbm
configuring socket
configuring stringio
configuring strscan
configuring syslog
configuring zlib
exts.mk:1471: *** commands commence before first target.  Stop.
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.
 

I'm assuming Rails is here, just not being seen. Just like bundler and openssl. Something is up and I don't know where else to look. How can I find it and get it back in action?


UPDATE

Though my SSL issues are still unresolved, I was able to do this workaround to get Rails up and running again (thanks Kevin-T!)

Since Rails was missing from both gemsets for ruby 2.2.4 (thanks 7stud for the gem list pointers), I needed to reinstall it. But I was getting this error when I ran gem install rails -v 4.0.12

ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

So I chose option 2: use a non-HTTPS source. In order to do that, I ran gem source to confirm that my source was https:

*** CURRENT SOURCES ***

https://rubygems.org/

I added the new http version with gem source --add http://rubygems.org :

https://rubygems.org is recommended for security over http://rubygems.org

Do you want to add this insecure source? [yn]  y  <-- I said yes
http://rubygems.org added to sources

I checked that it was added with gem source:

*** CURRENT SOURCES ***

https://rubygems.org/
http://rubygems.org <-- the new one

Then removed the https one with gem source --remove https://rubygems.org/:

https://rubygems.org/ removed from sources

At this point, running gem install rails -v 4.0.12 worked. Check out this post to install without the bulky documentation.

Community
  • 1
  • 1
richardsonae
  • 1,332
  • 11
  • 16

2 Answers2

0

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.


Well that's just silly. Rails was just here a moment ago.

First a warning: NEVER use sudo with rvm.

With rvm, there are two things that you need to pay attention to:

  1. The ruby version.
  2. The gemset.

A gemset is like a self contained package with certain gems in it. To see those gems, you have to be using that gemset. If you are using a different gemset, then you will see different gems.

In order to verify that a gem is contained in the gemset that is currently selected, you can do this:

$ gem list

For general instructions on how to use rvm wtih rails and various gemsets, see here:

Change rails version used by rvm

Interestingly enough, I am also unable to install the latest version of Ruby (2.4.0).

Your output shows that rvm is having trouble compiling zlib. It appears that the rbenv crowd is also having some problems compiling zlib on OSX. You might want to try their fix:

https://github.com/rbenv/ruby-build/issues/832

Community
  • 1
  • 1
7stud
  • 42,113
  • 12
  • 85
  • 111
0

Rvm had this issue not too long ago. It predates ruby 2.4.0, but maybe you're getting the same problem here? I suspect you're running an older install if you're running OS X 10.9. The solution recommended on that issue is to simply update your rvm with

rvm get master

I would try running that and then retrying your rvm commands.

Sidenote: pgp verification is now mandatory with rvm, so you may need to run

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

first.

Glyoko
  • 1,843
  • 11
  • 24