nathan
nathan

Reputation: 1506

Messed up Rails installation (OS X)

I had already installed rails 1.8.7, forgot about it, then installed 1.9.3 through RVM. I was getting weird errors, so I purged my Mac of the system version of Ruby and started again using RVM. So far I've

Installed Ruby:

rvm reinstall 1.9.3-p0
which ruby
/Users/User/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

Manually setup Rubygems

which gem
/Users/User/.rvm/rubies/ruby-1.9.3-p0/bin/gem

Tried to install rails

sudo gem install rails
Successfully installed rails-3.2.1
1 gem installed
gem list
rails (3.2.1, 3.2.0)

It says rails is installed, but which gem does not work, and when I try to use rails new I get:

-bash: rails: command not found

I'm definitely missing something here. The only explanation I can think of is that there are remnants of a previous ruby or rails install that's causing problems. Is there a way to start completely from scratch?

Upvotes: 0

Views: 387

Answers (1)

Phyo Wai Win
Phyo Wai Win

Reputation: 1160

If you are using RVM, you should not use "sudo" when you install gems. That will install gems to your system ruby version (not on the RVM rubies).

First, set up default rvm ruby like

rvm use ruby-1.9.3-p0 --default

Then, install rails on it by running:

gem install rails -v=3.2.1

It's actually better to use gemsets so you can have different gems set for the same ruby version. Check here for more info.

Upvotes: 2

Related Questions