14

Trying to install the new Rails 3 release on OSX 10.6.

Have never touched Ruby or Rails on this machine since purchased.

I was able to get rvm and get Ruby 1.9.2. installed. From there, I am stuck.

I tried:

rvmsudo gem install rails -v 3.0.0
sudo gem install rails --pre
sudo gem install rails
sudo gem update rails

And I get the same result error each time:

ERROR:  While executing gem ... (Errno::ENOENT)
    No such file or directory - /Users/kevin/.rvm/gems/ruby-1.9.2-head@rails3/cache/activesupport-3.0.0.gem

If I do gem list, it says LOCAL GEMS and doesn't list anything.

I have read a few walkthroughs but honestly none of them address this issue and its kind of pissing me off. Why is this so difficult to install? Would love to learn it if someone could help me get it running.

I was trying to follow this:

http://eddorre.com/posts/installing-rails-3-beta-4-using-rvm

and this:

http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard

Which is actually linked from the ROR guides website. Am I missing dependencies? How do I get them in?

If I do rails -v I get:

rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
    from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
    from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
    from /usr/bin/rails:18
Mario Uher
  • 12,249
  • 4
  • 42
  • 68
Kevin
  • 13,153
  • 11
  • 60
  • 87

9 Answers9

27

Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.

What I had to do this morning:

rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby          # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r             # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails         # check to be sure we are using rvm version of rails

Note: On newer versions of rvm, you will have to use rvm get stable instead of rvm update

Community
  • 1
  • 1
marshally
  • 3,541
  • 2
  • 23
  • 26
  • Even though that worked, I have to run rvm use 1.9.2 and rvm use 1.9.2@rails3 every time I start the terminal. Is there any way to replace the core OSX version of Ruby with 1.9.2 and Rails as well? – Kevin Sep 06 '10 at 18:21
  • Kevin try: rvm use 1.9.2@rails3 --default – Pragnesh Vaghela Sep 06 '10 at 20:38
  • Kevin: you can also create an .rvmrc file per directory, which will automagically change to the ruby version you want, whenever you enter that directory: http://rvm.beginrescueend.com/workflow/rvmrc/ – marshally Sep 07 '10 at 00:50
  • `rvm update` has been removed. To get the latest version the command is now `rvm get stable`. – Ross Allen Apr 19 '12 at 21:40
  • for LION - use rvm install 1.9.3 --with-gcc=clang http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues – johndpope May 10 '12 at 05:33
2

You don't need to use sudo when installing gems with rvm. If you follow the directions here to get RVM installed, you should be able to just do rvm use 1.9.2; gem install rails --version 3.0.0.

AboutRuby
  • 7,936
  • 2
  • 27
  • 20
  • I will try that. It said 1.9.2-p0 not found and to do rvm install ruby-1.9.2-p0. Running that now. – Kevin Sep 06 '10 at 00:54
  • 1
    Same exact error. I updated my question with the error I get from rails -v. – Kevin Sep 06 '10 at 01:08
  • The path of the Rails command being run is in /Library. If RVM were installed correctly, it would be in /Users/user/.rvm/. I suspect you haven't added the line to your .profile file, or something else went wrong. I suggest you just get rid of RVM entirely (rm -rf ~/.rvm), as well as any other Rubies you've installed and try installing it agaon, following the directions carefully. – AboutRuby Sep 06 '10 at 01:29
  • I've done this 3 times now with that guide and get the same result. What is wrong? – Kevin Sep 06 '10 at 02:48
  • I just don't know. All I can say is that in your post, the rails command is still the one that comes with OS X. – AboutRuby Sep 06 '10 at 03:30
2

You don't have to specify version 3. If you have 1.9.2-p0, it will automatically get rails 3 when you rvm gem install rails 3. note: no sudo. I think when you use sudo it makes it use the system-installed ruby. If you think you need sudo, use rvmsudo.

Things probably got messy because you were following guides based on the pre-stable release of rails, which involved many other things. If you like, you can try uninstalling rvm and re-doing everything. It really isn't all that difficult.

Remember, you need 1.9.2, 1.9.1 won't work.

curl -O http://rvm.beginrescueend.com/releases/rvm-install-head
sh rvm-install-head
rvm install 1.9.2-p0

# also remember to edit your bash profile and add the required lines

# verify that 1.9.2-p0 shows up there
rvm list

# makes it so you're using it, and sets it as the default
rvm use 1.9.2-p0 --default

# verify this happened. should have => 1.9.2-p0 in the list
rvm list

# verify the version
ruby --version

# should automatically get 3.0
# `rvm gem install` installs it for every single installed ruby version
# in my experience
gem install rails

When you did rvm gem install, I think it installs it for every ruby version you have registered with rvm (at least it happened in my experience), so my assumption is that it was trying to force install rails 3 for an older ruby installation, which was missing the required gems.

Take it easy, not many commands are required. If you find yourself having to do 'hacks' or workarounds, then you're doing it wrong. Thankfully it's easy to start over. To remove rvm, just do rm -rfv ~/.rvm and also rm ~/.rvmrc if it's there.

Let me know how it goes.

Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
  • Simple as rm -rfv ~/.rvm, :) also might want to remove ~/.rvmrc if it's there – Jorge Israel Peña Sep 06 '10 at 01:29
  • Same error. No such file or directory - /Users/kevin/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem – Kevin Sep 06 '10 at 01:50
  • So everything you did to verify you were doing things correctly were fine, right? Have you tried gem install activesupport ? – Jorge Israel Peña Sep 06 '10 at 01:55
  • Also, what command was it that is putting out this error, gem install rails? verbatim? – Jorge Israel Peña Sep 06 '10 at 02:04
  • gem install rails threw the error. gem install activesupport throws the same error – Kevin Sep 06 '10 at 02:06
  • can you post the entire output of gem install activesupport? weird that it would be throwing the same error. – Jorge Israel Peña Sep 06 '10 at 02:08
  • @Blaenk: Jeremies-MacBook-Pro:~ jeremieweldin$ gem install activesupport ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /Users/jeremieweldin/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem – Jeremie Weldin Sep 06 '10 at 06:04
  • I ended up getting it to work by closing out my open terminal windows and then running the sudo gem install rails in a new terminal window. If it works for you, please accept my answer as well. – Jeremie Weldin Sep 06 '10 at 06:14
  • Ignore my comment above. I think I have my .bashrc not working. RVM seems to be flaky at best for me. – Jeremie Weldin Sep 06 '10 at 06:29
  • Yeah, you guys are supposed to close the terminal and open it again when you add the correct lines to the bash profile, this will cause the lines to go into effect. Perhaps you guys forgot to do this? – Jorge Israel Peña Sep 06 '10 at 21:36
  • Nah I did that each time. Weird. Updating RVM got around all of this. – Kevin Sep 06 '10 at 23:09
2

working through this myself as new user mac osx blah blah

seems like a cache directory doesn't get made, try mkdir $HOME/.rvm/gems/cache

so far so good after that...

flummox
  • 21
  • 1
1

I am running into the same problem (tried uninstalling and installing like Blaenk suggested)

rvm -v rvm 1.0.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

gem install rails ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem

Pragnesh Vaghela
  • 1,327
  • 12
  • 16
1

After doing "rvm update && rvm reload" rvm got updated to 1.04 (instead of 1.02 which I got via the recommended GIT install yesterday!?) it worked nicely.

itsme
  • 141
  • 1
  • 7
  • Yes. This probably needs to get mentioned on the ROR guides website. I have a feeling a lot of people are running around this same problem as we speak. – Kevin Sep 07 '10 at 12:46
1

The solution worked for me, with a few tweeks:

Instead of using rvm update, I had to use rvm rubygems. Then, after doing all the work from post 2, I had to execute bundle install and I entered rvm use 1.9.2@rails3 to my .rvmrc file. Everything now works like a charm, even when starting a new shell or terminal session. The full list of commands I used is:

>> NEW >> rvm rubygems
rvm reload                 # update rvm
rvm gemset delete rails3   # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby                 # check to be sure the ruby interpretter is properly set to 1.9.2
>> DID NOT NEED >> hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails                # check to be sure we are using rvm version of rails
>> NEW >> bundle install
>> NEW >> cat 'rvm use 1.9.2@rails3' > .rvmrc
Hans W.
  • 11
  • 1
0

Followed these instructions, and found them very useful for rvm installation. Hope they work for you.

http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/

pdenlinger
  • 3,897
  • 10
  • 60
  • 92
0

Doing this after the rvm update and reload worked for me:

rm -rf .bundle && bundle install
jschorr
  • 3,034
  • 1
  • 17
  • 20