Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Cannot create new rails app due to Gem::LoadError (missing 'railties')

I got all the way to the step where I type rails new testapp, but when I do I get the following error:

/Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:296:in to_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError) from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:307:into_spec' from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in gem' from /Users/bastian/.rbenv/versions/2.0.0-p353/bin/rails:22:in<main>'

It looks like the railties gem is missing, so I try to install it. I do so by typing sudo gem install railties. (It tells me I don't have permission to install without sudo.)

I then try to create the rails app again, same error message. When I list the gems using gem list, here's what I get:

*** LOCAL GEMS ***

bigdecimal (1.2.0, 1.1.0) bundler (1.3.5) bundler-unload (1.0.1) io-console (0.4.2, 0.3) json (1.7.7, 1.5.5) minitest (4.3.2, 2.5.1) psych (2.0.0) rake (10.1.0, 0.9.6, rdoc (4.0.0, 3.9.5) rubygems-bundler (1.2.0) rvm ( test-unit (

I don't see railties on this list. Or rails or sqlite3, for that matter. Should I see them listed? I typed the commands to install them, as per the instructions.

One other possible clue. I listed the path using echo $PATH, resulting in the following:


I see what looks like an older version of ruby in there. And also rvm. Is this an issue? Maybe rvm and rbenv are fighting? Maybe different versions of ruby are fighting? I'm shooting in the dark here.

I'm totally new at this, and I'm really stuck at this point. Any help is most appreciated.

3 Answers

David Ker
David Ker
14,439 Points

Right off the bat, yes, RVM and rbenv are fighting, and are most likely at least part of your problem. When I get back on my laptop, I'll post a couple links I found helpful to uninstall rvm, since rbenv seems to be the most useful ruby version manager of the two.

Thanks, David! I'll look for your links.

David Ker
David Ker
14,439 Points

Sorry, I thought I had the links stashed in Evernote, but I can't find them! This one is the big one, actually removing RVM from your system - http://stackoverflow.com/questions/3558656/how-can-i-remove-rvm-ruby-version-manager-from-my-system

The other link I had was to reset your PATH, .bashrc, and .profile files. Are you familiar with how to edit those, and take out references to RVM? If not, I can try to walk you through it.

Still not quite there, but I think I'm making progress(?)

I followed the instructions in your link to remove rvm:

rvm implode


gem uninstall rvm

Then I found these instructions for editing the PATH variable. I ended up explicitly defining the PATH in .bash_profile. The path used to be this:


And after removing references to rvm, it reads:


I accomplished this by editing the .bash_profile file to read:

export PATH="/Users/bastian/.rbenv/shims:/Users/bastian/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin"
eval "$(rbenv init -)"

But even after all that, the issue persists. I install railties:

sudo gem install railties

That seems to work. Then I try to create a new rails app:

rails new testapp

And I get this error:

/Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError)
    from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
    from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /Users/bastian/.rbenv/versions/2.0.0-p353/bin/rails:22:in `<main>'

I'm totally at a loss. I managed to install the Treehouse VM and so I'm able to continue with the Rails courses that way, but I'd like to get to the point where I can set up the dev environment on my actual computer.

Sorry for the long post! In case we end up figuring it out I wanted to spell it out so it can serve as a resource to other folks down the line.

David Ker
David Ker
14,439 Points

Any progress is good progress! Some people like to say "new errors!!"

What do you get when you run which ruby and which rails in your terminal?