Uninstall old versions of Ruby gems - ruby

I have several versions of a Ruby gem:
$ gem list
rjb (1.3.4, 1.3.3, 1.1.9)
How can I remove old versions but keep the most recent?

# remove all old versions of the gem
gem cleanup rjb
# choose which ones you want to remove
gem uninstall rjb
# remove version 1.1.9 only
gem uninstall rjb --version 1.1.9
# remove all versions less than 1.3.4
gem uninstall rjb --version '<1.3.4'

For removing older versions of all installed gems, following 2 commands are useful:
gem cleanup --dryrun
Above command will preview what gems are going to be removed.
gem cleanup
Above command will actually remove them.

Way to clean out any old versions of gems.
sudo gem cleanup
If you just want to see a list of what would be removed you can use:
sudo gem cleanup -d
You can also cleanup just a specific gem by specifying its name:
sudo gem cleanup gemname
for remove specific version like 1.1.9 only
gem uninstall gemname --version 1.1.9
If you still facing some exception to install gem, like:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/rails/.rvm/gems/ruby-2.1.1#project/cache/nokogiri-1.6.6.2.gem
the, you can remove it from cache:
rm /home/rails/.rvm/gems/ruby-2.1.1#project/cache/nokogiri-1.6.6.2.gem
For more detail:
http://blog.grepruby.com/2015/04/way-to-clean-up-gem-or-remove-old.html

Try something like gem uninstall rjb --version 1.3.4.

gem cleanup uses system commands. Installed gems are just directories in the filesystem. If you want to batch delete, use rm -R.
gem environment and note the value of GEM PATHS
cd <your-gem-paths>/gems
ls -1 |grep rjb- |xargs rm -R

You might need to set GEM_HOME for the cleanup to work. You can check what paths exist for gemfiles by running:
gem env
Take note of the GEM PATHS section.
In my case, for example, with gems installed in my user home:
export GEM_HOME="~/.gem/ruby/2.4.0"
gem cleanup

bundler clean
Stopped the message showing for me, as a last step after I tried all of the above.

Related

Ignoring GEM because its extensions are not built

On both my work and home computers, I recently upgraded Ruby to 2.3.1, using ruby-install. I use chruby as my Ruby switcher.
I started seeing this warning in my terminal:
Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11
Ignoring bcrypt-3.1.10 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.10
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.0.5 because its extensions are not built. Try: gem pristine byebug --version 9.0.5
Ignoring byebug-5.0.0 because its extensions are not built. Try: gem pristine byebug --version 5.0.0
Ignoring concurrent-ruby-ext-1.0.2 because its extensions are not built. Try: gem pristine concurrent-ruby-ext --version 1.0.2
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
On my work, computer, the list was much longer, but easy to resolve. When I tried the suggested gem pristine GEM, it told me it couldn't find the gem, so I ran gem install GEM, and that solved it.
At home, nothing is working.
Things I have tried, from common sense and various other Stack questions:
gem pristine GEM
gem pristine --all
uninstalling and reinstalling the gem
gem update
gem update --system
bundle update
uninstalling and reinstalling bundler
uninstalling and reinstalling rails (Though, it's not a Rails specific problem.)
deleting ~/.bundle/
opening XCode and letting it install some extensions (It did need to do it, but it didn't fix anything.)
running brew doctor and solving all the minor issues, then brew update and brew upgrade
gem install curb (I can't imagine what this gem has to do with this issue, but two different people listed it as the last step of their fix to the same warning.)
I came across this exact issue today - getting warnings like this for gems that weren't even installed!
... Well, it turns out the gems were installed - for a different ruby than the one I had set active with chruby (2.2.3 vs 2.3.1).
Switching to all the different rubies and running gem pristine --all on all of them solved the problem.
I ran into this issue and followed all the same commands as above, even going so far as to remove all my previously installed Ruby versions. However, the error persisted.
Turns out, there were some leftover gems for the various (previously uninstalled) versions in ~/.gem/ruby/. After removing the folders I no longer used, the errors disappeared.
I've had this problem today too and it frustrated because I couldn't type because my whole editor flashed red with error messages.
I'm not entirely sure what exactly caused it but I believe it's because we have multiple ruby versions OR multiple ruby version managers installed and they overwrite each other and otherwise mess up your paths towards the gems.
The gem command also gets overwritten when you have rbenv and rvm.
See which ones you've installed by typing;
which rvm
which rbenv
which chruby
If one of those is installed it'll return a path. Then delete them, make sure to completely clean out all the directories and start with a clean install.
Remove
Here's what I did for rvm;
rvm implode
gem uninstall rvm
rm -rf ~/.rvm
rm -rf ~/.rvmrc
Here's what I did for rbenv
First installed https://github.com/meowsus/rbenv-clean, then
rbenv clean
sudo apt-get remove rbenv
rm -rf ~/.rbenv
Reinstall
Then you have a clean home directory to work from. I reïnstalled rbenv with How to install Ruby 2.1.4 on Ubuntu 14.04. And finally;
rbenv rehash
In my case the warning itself has suggested the solution , so I just run them one by one.
Ignoring bigdecimal-2.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 2.0.0
Ignoring date-3.0.1 because its extensions are not built. Try: gem pristine date --version 3.0.1
Ignoring dbm-1.1.0 because its extensions are not built. Try: gem pristine dbm --version 1.1.0
Ignoring etc-1.1.0 because its extensions are not built. Try: gem pristine etc --version 1.1.0
Here an example:
gem pristine bigdecimal --version 2.0.0
so running the command of each line has solved my problem.
I did everything mentioned above including
xcode-select --install
reinstall ruby
reinstall all gems
gem pristine --all
but the issue was the same for me.
I just rebooted my Mac as the last hope, and the warning messages are disappeared.
Weird, but if anyone's struggling with this issue after trying everything on StackOverflow, try reboot your machine.
Running gem pristine --all didn't help at first, but then I realized: the script I was running began with the line:
#!/usr/bin/ruby
On my macOS system (Catalina, but I don't think it matters), this points to the Ruby that came with the system, not the one installed by RVM. Running gem pristine --all was fixing up the RVM installation, but my script was calling a different version of Ruby.
The fix for me was to use the env command to call whichever Ruby is specified in the current shell's PATH. Changing the top line of the script to this fixed it:
#!/usr/bin/env ruby
Adding my own flavor here. I use rbenv installed via Homebrew and was getting four of these "ignoring... extensions not built" messages. Specifically:
Ignoring bcrypt-3.1.12 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.12
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring bootsnap-1.3.2 because its extensions are not built. Try: gem pristine bootsnap --version 1.3.2
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
I tried many things in this thread with no luck. Finally in my case I did:
brew uninstall rbenv
rm -rf ~/.rbenv
brew install rbenv
At this point I was still getting the errors, but now I had only a single Ruby version to contend with:
$ rbenv versions
* system (set by /Users/will/.rbenv/version)
At this point I tried sudo gem pristine --all but was rejected for permissions on the system Gems directory.
So I went through and ran pristine on each gem, like
sudo gem pristine bcrypt --version 3.1.12 (etc)
And finally the errors were gone.
If you have installed RVM, possible you're catching the error because you have installed different versions.
Check and remove useless versions,
but I think this is not good approach.
Anyway errors gone.
rvm list
rvm use ruby-version
rvm remove ruby-useless-version
After refresh cocoapods, it should be injected in .rvm GEM_HOME
gem uninstall cocoapods
gem install cocoapods
Probably pod COMMAND will throw the error about minitest gem, so – gem install minitest
Running Mac OS Catalina, brew and rbenv ...
Having come across this exact problem today, and gone through all the answers here I eventually stumbled across another reason for this error:
Ignoring nokogiri 1.10.7 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.7
And of course gem pristine did no work.
My problem was a hard coded GEM_HOME and GEM_PATH environment variables which were overriding rbenv.
So, check that you haven't set GEM_PATH and GEM_HOME in ~/.zshrc
TL;DR - Ruby gems don't like Rubies running from symlinks or moved from where they were built (because of embedded shebangs)
If the Ruby directory is invoked or environment vars point to a symlink'ed directory, or are copied or renamed, this message is likely. I am using chruby and was symlinking /opt/rubies/ -> /usr/local/ruby/, but Ruby's dynamic library-finding logic doesn't play well with this.
The solution in my case was to replace the symlink with actual rubies in /opt/rubies/ and run gem pristine --all in each Ruby. For others using RVM or Rbenv, good luck with that without starting over from scratch.
This may not be your exact issue, but hopefully it helps.
This is an old thread, but I just came across this issue myself.
You don't need to restart your machine, you just need to refresh your environment, you can do this with the rehash command:
rehash
From the man page: rehash command re-computes the internal hash table of the contents of directories listed in the path environmental variable to account for new commands added.
Most comments here are on the right track. This problem often occurs after a Ruby version upgrade. I reviewed the gem command code and here is the gist of it.
Extensions are compiled into the gems/gem/ext subdirectory of the gems home directory. For example, on my Cygwin installation (and similarly under Raspbian), the BigDecimal extension is compiled into
/usr/share/gems/gems/bigdecimal-1.3.5/ext/bigdecimal/bigdecimal.so.
However, this is not where the extension is referenced when executed - that is from
/usr/lib/gems/ruby/ver/gem. Again using BigDecimal, the extension file when executed is loaded from
/usr/lib/gems/ruby/2.3.0/bigdecimal-1.3.5/bigdecimal.so
Here is the key: in this same directory, there is an empty tag file
/usr/lib/gems/ruby/2.3.0/bigdecimal-1.3.5/gem.build_complete
When the gem command starts up, it refers to the gems/specifications directory to get a list of installed gems and information as to whether they have extensions. If a gem does have extensions, gem (among other sanity checks) looks for the tag file gem.build_complete. If that is not found, it emits the error message "Ignoring gem because its extensions are not built".
Any action which rebuilds all extensions will fix this problem. Or, as total hack, if you in a hurry and brave, you can try copying all contents of /usr/lib/gems/ruby/oldver to /usr/lib/gems/ruby/newver e.g.
cd /usr/lib/gems/ruby
cp -nv 2.3.0/* 2.6
This is also a problem when you're developing on Mac and then build a Docker image:
https://forums.aws.amazon.com/thread.jspa?messageID=879802&tstart=0
When you do a "bundle install --deployment", bundler will create a
vendor directory w/ your gems in it. Note that whilst this includes
your gems in the local folder, it will only include the native
extensions for your platform. As you're on macOS this will be Darwin.
You'll need to do repeat the process on a 64-bit x86 linux
environment.
Libby's suggestion to just start a new terminal session (which she commented on Sebastian Kim's answer) worked for me. Much quicker than any of the others too so I wanted to make it an answer so it was more visible.
I had this problem but only when I was starting tmux session using tmuxinator.
Turned out it's because I'm using tmuxinator from brew instead of installing it using gem install. Maybe using chruby at the same time contributed to the problem as well.
p/s: I also removed unused ruby from ~/.gem/ruby but I doubt that's the reason this issue was resolved for me.
Uninstall and reinstall of Vagrant also works. There's an unistall.tool bash script included in the installer .dmg image that will remove Vagrant.
Found this solution here: Updating Vagrant and Gems Extentions Not Built In
I had the same issue and I'm using rbenv. For some reason my global rbenv setting went missing. In order to fix this problem I set the global version to one of my rbenv versions... for instance:
rbenv global 2.5.1
On my case I was trying to run pristine --all but I was getting:
Ignoring ffi-1.11.1 because its extensions are not built. Try: gem pristine ffi --version 1.11.1
Ignoring jaro_winkler-1.5.3 because its extensions are not built. Try: gem pristine jaro_winkler --version 1.5.3
Ignoring psych-3.1.0 because its extensions are not built. Try: gem pristine psych --version 3.1.0
/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /.gem/gems/psych-3.1.0/lib/psych.bundle (fatal)
Then, I deleted the content on Users/{{user.name}}⁩/⁨.gem⁩ then as I needed to run bundle install --force, it reinstalled everything, then the command pristine --all worked as expected
This solution worked for me for RubyMine IntelliJ
I had two different terminals being used and RVM and ruby<Version>.
Solution:
I had to switch it to the RVM version for the errors to go away in Preferences>Languages&Frameworks>Ruby SDK
Errors:
Ignoring executable-hooks-1.6.0 because its extensions are not built. Try: gem pristine executable-hooks --version 1.6.0 rubymine
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
If you are using rvm like me, the fix could a simple:
rvm get stable
rvm reload
As stated in this answer https://apple.stackexchange.com/a/192513
I have executed these commands in Terminal and worked for me:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ruby, it may need sudo (sudo brew install ruby).
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
sudo gem pristine --all
In Ubuntu this worked for me.
source ~/.bash_profile
sudo gem pristine --all

Can't remove hidden SASS 3.3.0 gem

I have installed installed RVM and tried to setup compass - had some errors, so I tried to do it by installing Ruby and then doing everything step by step. THe thing is RVM gems conflict with the ruby gems and whatever I do, even though I Removed .rvm and ran rvm implode and searched for the sas 3.3.0 folder and deleted it manually it still says that ..., because sass-3.2.19 conflicts with sass (~> 3.3.0) . WHen I do gem list it does not show 3.3.0 , when I try to run compass it's always the same, i'm tired of searching for solutions, but I don't want to reinstall my ubuntu and set everything all up again.
What else could I try to remove that hidden gem from the system? I tried everything I could find - no use at all! There has to be a way to exclude taht dependency to not include 3.3.0 at all!
Maybe installing rvm and creating new gemset would help?
These commands might help you out:
# remove all old versions of the gem
gem cleanup rjb
# choose which ones you want to remove
gem uninstall rjb
# remove version 1.1.9 only
gem uninstall rjb --version 1.1.9
# remove all versions less than 1.3.4
gem uninstall rjb --version '<1.3.4'

rbenv: multiple instances of SAME ruby

I have two scripts which require the same version of Ruby. However, each script also requires a DIFFERENT version of a gem (nokogiri). One of the scripts will run with both versions of nokogiri (1.6.2.1 and 1.6.1). However the other script will ONLY run with version 1.6.1; and if 1.6.2.1 is installed, the script will not execute normally.
I know how to install multiple versions of Ruby with rbenv. But is it possible to install multiple instances of the SAME version of Ruby (2.1.2)? If so, how?
Make a local copy of a ruby-installer definition file using a custom name.
$ cp ~/.rbenv/plugins/ruby-build/share/ruby-build/2.1.5 2.1.5-nokogiri161
Install this as a custom definition file, no edits required.
$ rbenv install ./2.1.5-nokogiri161
Now you have a ruby version with a custom name and you can install custom gems on it.
$ rbenv shell 2.1.5-nokogiri161
$ gem install nokogiri -v 1.6.1
This is also useful for installing ruby versions with custom build flags. For example, a debug build with no compiler optimizations.
$ cp ~/.rbenv/plugins/ruby-build/share/ruby-build/2.1.5 2.1.5-debug
$ RUBY_CONFIGURE_OPTS="optflags=-O0" rbenv install ./2.1.5-debug
$ rbenv shell 2.1.5-debug
1) Use rvm instead of rbenv, and using it feature called 'gemsets' you could use different versions of gems for one version of ruby
rvm 2.1.1
rvm gemset create first second
rvm 2.1.1#first
gem install nokogiri -v 1.6.1
rvm 2.1.1#second
gem install nokogiri -v 1.6.2
2) or you can use bundler
gem install bundler
/dir_1/Gemfile
source 'http://rubygems.org'
gem 'nokogiri', '1.6.1'
/dir_2/Gemfile
source 'http://rubygems.org'
gem 'nokogiri', '1.6.2'
I see two options:
You could have different Gemfiles and let bundler take care of setting the right gem-version. If the scripts are in different directories, it should be no problem.
You could use rbenv-gemset to have separate gem-environments
There are undoubtly more, but those two seem the easiest for your setup.
Multiple instances of the same ruby is possible (regardless of the tool installing them) by just compiling them manually, with a different --prefix configured.
download the source
extract it
./configure --prefix=~/.rbenv/version/2.1.2-tSquirrel
make
sudo make install
This is how the rbenv-docs propose to achieve this.
You could also rename the current "2.1.2"-directory and then use ruby-build to install 2.1.2 again.
"Versions" in rbenv are just directories in ~/.rbenv/versions, I would guess you cold just rename/copy installed version and when you "select" version with "rbenv shell" you just declare from which directory you want to use binaries.

Removing all installed Gems and starting over

I recently started learning Ruby and Ruby on Rails, and have watched a plethora of getting started materials. I have been finding lately that I keep getting errors where gems won't install or they will be installed but they can't be used for some reason, and I have decided that I want to remove everything down to once again just having Ruby installed and start over with the installation. One training video had me install most of my gems with RVM, so I don't know if that changes anything.
So in short my question is "How to I get rid of RVM, Rubygems, and all installed Gems so that I can start over with just Ruby?"
Edit: I am on Mac OS 10.6
gem uninstall -aIx
Uninstalls all gems without prompt.
Options
-a, --[no-]all Uninstall all matching versions
-I, --[no-]ignore-dependencies Ignore dependency requirements while
uninstalling
-x, --[no-]executables Uninstall applicable executables without
confirmation
From the RVM support site:
RVM installs everything into ~/.rvm.
To remove RVM from your system run 'rm
-rf ~/.rvm'. You may have one additional config file in ~/.rvmrc and
of course the RVM hook in your
bash/zsh startup files.
So, just go to the command line and type rm -rf ~/.rvm
All the installed gems are in the ~/.rvm folders, so doing the above will remove the gems and installed rubies in one go.
Gems you added pre-RVM with the default ruby install can be removed by typing this at the command prompt:
for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
For Windows and Unix copy/paste in command prompt (Ruby 1.9.x).
ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.strip.empty? }"
using RVM, you could just type...
rvm gemset empty GEMSET
where GEMSET is the gemset which you would like to empty. then...
install bundle
yum install bundler and finally
bundle install
rvm implode (see cli docs) seems to work - and it even tells you where to look at for leftovers
This is work for me on Ubuntu 16.04. For me, when I was executing
command rails -v it throw errors because of NameError. I have
installed 3 version of rails (4.2.0, 4.2.6, 5.0.0.1). I was trying
to uninstall unnecessary gem using command gem uninstall rails -v
version number but I won't able to, but I find a way to solve
this problem. In order to uninstall all gems, you have to loop
through all entries in gem list with bash scripting. This method is
very inconvenient. Thanks to Rubygems 2.1.0, you now could do it
with one command.
STEP - 1
Firstly, please make sure you upgrade your Rubygems to 2.1.0 or
newer. For this run this command (Incase you are working on an older
version. You can check your gem version using this command any one
of them gem -v or gem --version)
gem update --system
gem --version
STEP - 2
Run this command in you terminal
gem uninstall --all
Step - 3
Install gem bundles (it is not necessary I think just for
precautions)
gem install bundle
Step - 4
Install the rails on your system using this command
gem install rails -v specific version you want to install you can check the rails version on the official site rails all versions
example :- I have installed rails 4.2.6
version, you install as per requirement.
gem install rails -v 4.2.6
Step - 5
Finally check the version of installed rails framework application
by Using basic command rails -v. It will echoed the current
version of rails frameworks. Enjoy :)
References
http://ruby-journal.com/how-to-uninstall-all-ruby-gems/
http://guides.rubyonrails.org/v4.1/getting_started.html
Step 1:
I first kept running into an error that said:
You don't have write permissions for the /usr/bin directory
To get permission, I became a root user with (this is potentially dangerous for reasons beyond my current understanding):
sudo -s
Credit
Step 2:
Then, I kept running into an error that said:
[gem] cannot be uninstalled because it is a default gem
This allowed me to uninstall everything:
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
Credit
FWIW, there are some weird cases where gems are installed but not really installed:
This should do the trick reasonably reliably.
gem uninstall -Iax `gem list | grep default | awk '{print $1}'`

Install Rails 3 on OSX with RVM

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
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
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.
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.
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...
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
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.
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
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/
Doing this after the rvm update and reload worked for me:
rm -rf .bundle && bundle install

Resources