Trouble with Ruby on Rails

Some background info: I am an OS X user, and my MAC system is OS X
10.6.8(snow leopard).

@1st problem (regarding Ruby on Rails installation):
I have installed ruby "1.9.2" with RVM. When I typed "ruby -v" command
in terminal after installation, it says that the ruby version I have
is "1.8.7". Strange, isn't it? So, I have tried "rvm use 1.9.2"
command, but it still says my ruby version is 1.8.7. I even re-
installed ruby 1.9.2 using RVM a few more times, but no luck. when I
typed "rvm list", it says "ruby-1.9.2-p290". Does that mean my rvm did
install ruby 1.9.2, but for some reason, i cannot get my RVM switch to
ruby 1.9.2 from ruby 1.8.7?
what can i do to use ruby 1.9.2??

By the way, when I typed "rvm info", and it says "ruby-1.9.2-p290" and
then all the other stuff explaning. Does that mean that my rvm already
has switched ruby to 1.9.2??? But, then, why "ruby -v" keeps saying
""ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]"???

It seems like OS X 10.6.8 already comes with Ruby 1.8.7, and should it
be the reason behind this problem?

Without being able to solve the problem above, I have continued Ruby
on Rails journey (have well installed rails 3.0.9 along with all the
others: rubygem, git, etc), and landed on the second problem.

@2nd problem (regarding lesson2: demo app):
With my attempt to make a demo app, I typed "rails generate scaffold
User name:string email:string" command in terminal to generata
resources. And, I have typed "rake db:migrate" to build Ruby. Then, I
got an error stating: "/Users/taek/.rvm/rubies/ruby-1.9.2-p290/lib/
ruby/site_ruby/1.9.1/rubygems.rb:314:in `bin_path': can't find gem
rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
    from /Users/taek/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in
`<main>'"

When I googled, some posts suggested to delete rake.gemspec(in "/Users/
taek/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/specifications"
folder). Their point was that Ruby 1.9.2 comes with a version of rake
internally, so it has a problem finding it because of the rake.gemspep
file in "/Users/taek/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/
specifications" folder. However, I was not able to locate that file
in my system ("/Users/taek/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/
1.9.1/specifications" folder), so I deleted "rake-0.8.7.gemspec"(which
seems to be the same file as rake.gemspec) file instead. But, that did
not solve the porblem. Instead, it gave me another error, which is
LoadError. So, I restored "rake-0.8.7.gemspec" file in the
folder(since i made a back-up copy before deleting it). What can I do
to fix this problem? Would this problem related to the first problem
(that Ruby 1.8.7 is not installed in my system)?

Can anyone please help me?

Thank you in advance!

Taek

Hi there,

It helps if you break the problems in smaller parts and have a related subject.

Anyway, ruby -v should say 1.9.2.

Can you show the result of doing rvm list and rvm 1.9.2 and then ruby -v?

It seems like OS X 10.6.8 already comes with Ruby 1.8.7,

Yes, macs come with ruby already.

and should it be the reason behind this problem?

No

1) Say this out loud: DON'T EVER USE the sudo command WITH RVM!!!!.
Shout that out your window ten times. Next get a tablet of paper, and
write on the paper ten times: 'DON'T EVER USE the sudo command WITH
RVM!!!! Then ride your back down to your local tattoo parlor, and on
both arms get the following tattooed down the length of each arm in two
inch high block letters: 'DON'T EVER USE the sudo command WITH RVM!!!!
Once your tattoos heal, continue with step 2.

2) After installing rvm, never use the sudo command with anything rails
related. NEVER!! Exception: I think it's ok to use sudo if you decide
to do this:

[sudo] gem update --system 1.8.5

After that, go here and follow the instructions (and if you ever type
'sudo' after installing rvm, chop both your arms off):

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:up_and_running

"J. Pablo Fernández" <pupeno@pupeno.com> wrote in post #1017829:

I had the same problem you did--because I used the sudo command at some
point. Somehow that screwed everything up. So, I deleted the .rvm
directory:

Then, I got an error stating: "/Users/taek/.rvm/rubies/ruby-1.9.2-p290/...

$ rm -rf /Users/taek/.rvm

Then I started over, and after installing rvm, I never used sudo again.
The directions I linked to should help you get everything installed
correctly.

7stud -- wrote in post #1017958:

B. Taek K. wrote in post #1017990:

7stud -- wrote in post #1017958:

I had the same problem you did on OSX 10.6.7--because I used the sudo
command at some
point. Somehow that screwed everything up. So, I deleted the .rvm
directory:

Then, I got an error stating: "/Users/taek/.rvm/rubies/ruby-1.9.2-p290/...

$ rm -rf /Users/taek/.rvm

Then I started over, and installed rvm using these instructions:

http://beginrescueend.com/rvm/install/

Suit yourself, though.

-----------------------------------------

Thanks for your comments, 7stud!

You were right about my problem. The problem was with rvm! Though, I
don't remember using sudo when I installed rvm, Ruby, and rails. I
rarely use sudo unless the system requires me to use sudo to install
some programs.

Your system does require you to use sudo to install things.

You can search google about the sudo problem -- there are lots of hits.
rvm changes the PATH in the current shell, but sudo reloads(?) the shell
and retrieves the original PATH as a security measure. Then if you
install a gem, it gets put in the wrong directory, or the rvm links get
screwed up--or something--because the PATH isn't what rvm set up.

Anyway, the bottom line is that I updated rvm instead of removing it.

I would have just removed the .rvm directory. Now if anything weird
happens, you won't know whether some link is screwed up somewhere, or if
you just did something wrong.

followed rvm instructions: http://beginrescueend.com/rvm/install After
updating rvm, I was able to install Ruby 1.9.2(!!), and the problem with
"rake" command was gone!!!

I should have suspected rvm sooner, then I wouldn't have wasted one
week!

Thanks!

Sure. Good luck.