0

I'm following Michael Hartl's Ruby on Rails tutorial book and am trying to install rails. As the book says, I followed the instructions on InstallRails.com and got through most of it until I was told to run rails server and I kept getting the error that I didn't have railties gem not installed. I had initially ran sudo gem install rails and so I read that it didn't pick up railties for some reason but gem install rails did - so that fixed it. So now I was able to run rails server and the app was live.

I returned to the book and as the instructions say, I generated a new rails app, specifying the rails version (4.2.2). However, when I run rails again, I get errors. At this point, having tried a dozen different stackover flow solutions, I feel like I must have screwed up the files and maybe I should just get rid of rails completely and try installing from scratch.

Here's some information on where I'm currently at:

Faiques-MacBook-Pro:Desktop Faique$ rails -v
Rails 4.2.3
Faiques-MacBook-Pro:Desktop Faique$ ruby -v 
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Faiques-MacBook-Pro:Desktop Faique$ mkdir workspace
Faiques-MacBook-Pro:Desktop Faique$ cd workspace
Faiques-MacBook-Pro:workspace Faique$ rails _4.2.2_ new hello_app/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (= 4.2.2) - did find: [railties-4.2.3] (Gem::LoadError) 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ ubygems/dependency.rb:307:in `to_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /usr/bin/rails:22:in `<main>'

I'm not sure what other information I should provide.

Faique Moqeet
  • 549
  • 1
  • 4
  • 9
  • 1
    Update: I decided to follow this question: http://stackoverflow.com/questions/3558656/how-can-i-remove-rvm-ruby-version-manager-from-my-system and have ran the commands: 'rvm implode' and 'gem uninstall rvm' – Faique Moqeet Aug 15 '15 at 14:06
  • Did that fix it? Don't use sudo when installing gems if you're using rvm. It's purpose is to keep Ruby versions separate, and using sudo to install can cause issues like the one you described. – stephhippo Aug 15 '15 at 15:56

1 Answers1

0

This isn't an ideal solution but what I ended up doing was completely restoring my mac and then reinstalling rails but using rbenv instead as per a friend's recommendation. I am now set up with Rails.

I wanted to do a complete restore (deleting all my data) because I had tried so many stack overflow answers for different errors - including using sudo for certain commands - that I'm sure I had messed some important settings and would take a long time to figure out. I think this was surprisingly one of the more efficient solution, although far from ideal.

Faique Moqeet
  • 549
  • 1
  • 4
  • 9