55
➜  ~  rvm -v

rvm 1.10.2 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/]

➜  ~  ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
➜  ~  rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
    from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜  ~  

I installed a clean installation of ruby just now, and rails, I removed all my previous gems, and I still keep getting this error. Any ideas ? And yes, I had this error before, and this is what I did

A little more info:

➜  ~  gem list

*** LOCAL GEMS ***

actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.1)
arel (3.0.0)
builder (3.0.0)
bundler (1.0.22 ruby)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2, 0.9.2)
rdoc (3.12)
sprockets (2.3.0, 2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)

➜  ~  gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
➜  ~  rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
    from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜  ~  
Community
  • 1
  • 1
pyronaur
  • 3,515
  • 6
  • 35
  • 52

11 Answers11

100

It means your Rails installation is corrupted or incomplete. If you list your gems, chances are you won't find railties

$ gem list

Run the command

$ gem install rails

again. It will download and install missing dependencies, including railties.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
36

I ran into the same problem and, in my case, it turned out to be because I had installed using sudo - it does not necessarily make rails available to ordinary users. Try running just gem install rails if you previously ran sudo gem install rails.

Arkaaito
  • 7,347
  • 3
  • 39
  • 56
16

Worked for me

rvm reinstall 1.9.3

then

gem install rails
Haris Krajina
  • 14,824
  • 12
  • 64
  • 81
15

I ran into this same issue. If you're using RVM it's possible you switched to the wrong Ruby version which causes a gem load error if the directory uses a different version than the one you are currently set to use.

To fix, type rvm use -yourrubyversion in the app's directory in terminal. For example, if your app is set up to use ruby 1.9.3 type rvm use -1.9.3.

RVM works by separating your gems by ruby version by app, so if you switch to a different ruby version RVM will separate previously used and installed gems from the different ruby version, which is why you may be seeing tho issue.

Verdi Erel Ergün
  • 1,021
  • 2
  • 12
  • 20
  • This one did it for me. I had to use rvm use system, though. I was following the rails tutorial and had originally installed ruby and rails natively, and then decided later that I wanted rvm... so moral of the story is plan ahead and make sure you know what you want before you go installing these types of frameworks. At least Ruby has good docs and community support. – josiah May 19 '13 at 00:10
14

rvm implode was the answer. Something probably went wrong before, now everything works after a rvm reinstall.

pyronaur
  • 3,515
  • 6
  • 35
  • 52
8

Maybe you installed two or more version of rails and railties.

gem uninstall railties
gem uninstall rails

then reinstall.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
5

I got the same error when I installed ruby 1.9.3p194

and then I reinstalled ruby and rails

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
vidur punj
  • 5,019
  • 4
  • 46
  • 65
  • Solution to this is available here:[solution is here](http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/) – vidur punj Aug 08 '12 at 11:49
2

Simone's answer is great. However, if you already have your Rails gem in your Gemfile, just try to use bundle exec instead:

bundle exec rails c

And that should suffice. If not, then add

bundle install

before the mentioned command.

valk
  • 9,363
  • 12
  • 59
  • 79
2

I also had this issue after I installed ZSH (Wanted to mess with it's templates.)

Ran

brew update

which did find some updates I wasn't missing before, but in the end

gem install rails

suddenly completely re-installing the rail/ties system. Unsure why ZSH removed it.

DNorthrup
  • 827
  • 2
  • 8
  • 26
0

Uninstalling ruby, and railsinstaller and then installing railsinstaller again worked great for me!

saada
  • 2,612
  • 3
  • 27
  • 33
0

I did 'gem install rails' on my system (ubuntu) and it installed the missing gems approx 28 of them then i did 'gem list' to check and it was all there.

user229044
  • 232,980
  • 40
  • 330
  • 338
knaija
  • 34
  • 4