Samuel
Samuel

Reputation: 6146

Getting rails error

I previously installed rails with the preinstalled ruby that comes with mac. I have recently installed ruby through rvm.

I then did

  rails -v 

and got the following error

 kingsosina$ rails -v
 /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find      'railties' (>= 0) among 5 total gem(s) (Gem::LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'

What has gone wrong here? Do I need to gem install rails again?

my lastest output

 kingsosina$ which ruby
 /Users/kingsosina/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
 kingsosina$ which rails
 /Users/kingsosina/.rvm/gems/ruby-2.0.0-p353/bin/rails
 kingsosina$ which gem
 /Users/kingsosina/.rvm/rubies/ruby-2.0.0-p353/bin/gem
 kingsosina$ 

Does everything seem ok? and how does terminal know to reference this version of ruby instead of the pre-installed version on the mac, when i do ruby -v?

Upvotes: 0

Views: 1704

Answers (2)

AndyV
AndyV

Reputation: 3741

For what it's worth, the paths shown in your error output indicate that you're still referencing the OSX version of ruby. You'll want to enter the directory and type

rvm use X.X.X-pXXX

where X.X.X-pXXX is the ruby version that you want rvm to use. You can also add a file called .ruby-version with X.X.X-pXXX in it and rvm and other ruby version managers will switch to the appropriate version for you. Adding a .ruby-gemset file will also switch to the appropriate set of gems.

Finally, you'll need to make sure that the gems are installed in the rvm ruby/gemset combination. Putting that all together, to get started with the latest ruby and latest rails gem you would...

rvm install 2.0.0
rvm use 2.0.0
rvm gemset use --create my-project-gems
gem install rails

Upvotes: 3

DiegoSalazar
DiegoSalazar

Reputation: 13531

Did you install newer version of ruby along with the rvm install? Do rvm list to find out what rubies your have installed. Then do rvm use <ruby-version-here> to select a ruby with rvm. Then you need to gem install rails again because its a new ruby. If you get a permission denied error trying to install gems try rvmsudo gem install rails.

Upvotes: -1

Related Questions