How do you update rubygems using rvm and ree? - ruby

How do you update rubygems under rvm when ree is your default vm (on Snow Leopard)? I am doing:
$ rvm ree gem update --system
This results in things looking like everything went fine:
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.7
Updating RubyGems to 1.3.7
Installing RubyGems 1.3.7
RubyGems 1.3.7 installed
[...]
RubyGems installed the following executables:
/Users/douglassellers/.rvm/rubies/ree-1.8.7-2010.02/bin/gem
but when I run gem --version it still says 1.3.5. Doing a which gem points at ree version of gem.
Anyone know how to get rubygems to update with RVM?

Now you can just do :
rvm rubygems latest
Or you can define which rubygems you really want. https://rvm.io/rubies/rubygems/

The problem, I think, is the initial command (or what you expect that command to do):
$ rvm ree gem update --system
That tells rvm to pass the gem update --system to the gem under ree, but it doesn't switch you to that particular Ruby interpreter. You continue using whatever interpreter you have set in that shell (whether by default or because you switched manually earlier in the shell session).
As an example, my default interpreter is Ruby 1.9.2. If I pass this command: rvm 1.9.1 gem install pony, then the Pony gem is installed for Ruby 1.9.1. However, I'm still using Ruby 1.9.2 after that installation is finished. If I enter irb and try require 'pony', I get a load error. If I run rvm 1.9.1 and then enter irb, Pony is installed and loads fine.
So as Brian says in his comment to your post, you could switch manually with rvm use ree. Alternatively, you could switch your initial command to this:
$ rvm ree
$ gem update --system
$ gem --version

rvm suggested me to use something like this:
rvm ruby-1.9.3-p327#mygemset do gem update --system

It is an unusual problem.
If it is not yet resolved, consider using
rvm --default use ree
which ruby
which gem
this should show you if you are in the right version.
install gems either using rvm or directly.

Related

Rvm version error

I have installed many flavors of ruby on rvm, and using following command to change rvm ruby versions.
rvm use 1.9.3
then ruby -v gives me following result
ruby 1.9.3p551 (2014-11-13 revision 48407) [i686-linux]
but when i try to run any commands like rails s or bundle install
it gives me following error
Your Ruby version is 2.3.1, but your Gemfile specified 1.9.3
Using
rvm list
you can get list of ruby version on your system along with current & default versions.
If ruby version is not specified in Gemfile, then it is generally considering default rvm version.
But if it is specified in Gemfile, then that version of ruby should be installed in your system along with its bundler.
First make sure ruby version either installing or using it,
rvm install '1.9.3'
rvm use '1.9.3'
To install bundle of required ruby version, run this command
gem install bundler
That's can happens, when you trying to use fresh installed ruby without bundler, all newest installed ruby should also include bundler installation.
$> rvm use 1.9.3 && gem install bundler # may terminal reload needed
$> bundle install
$> bundle exec rails s

github-pages gem failing even though I have Ruby version 2.1.2

I'm trying to install github pages gem on my Mac OS X (yosemite).
I get following error:
Gem::InstallError: github-pages requires Ruby version ~> 2.0.0.
An error occurred while installing github-pages (4), and Bundler cannot continue.
Make sure that `gem install github-pages -v '4'` succeeds before bundling.
I checked my Ruby version by running following command -
ruby --version
And it says
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
So I definitely have Ruby version ~> 2.0.0
Any assistance on this issue would be greatly appreciated!
There is a possible lack of important information here. Looking at your Ruby version, are you using rbenv or rvm?
I could imagine this happening if you use rbenv or rvm and then su or sudo to gem install github-pages. rbenv and rvm are specific to your user account and your shell environment. If you su or sudo to root, rbenv and rvm are no longer active.
The other possibility is that you are running it inside of a Bundler managed app that specifies another Ruby version in the Gemfile using the ruby x.x.x syntax.
If neither of these is the case, try running gem env to see what exactly rubygems thinks the story is. Also post the exact commands you are using to get this error.

How do you uninstall RVM gem?

Strange... but this is what I got :
$ gem list | grep rvm
>> rvm (1.11.3.3)
$ gem uninstall rvm
>> INFO: gem "rvm" is not installed
How can that be possible? The root of this problem probably stems from me downloading the latest RVM and finding that it does not work with the latest version of POW. Thus I had to implode RVM and reinstall an older version. Since then when I do a cap deploy, I get the classic :
`<top (required)>': RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)
Any ideas?
I recently encountered the same rvm error:
"RVM - Capistrano integration was extracted to a separate gem, install: gem install rvm-capistrano and remove the $LOAD_PATH.unshift line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)"
Doing what the error suggested did not work for me at all.
What did work for me was to do: rvm -v
When I did this I saw that my rvm version was rvm 1.13.0
Using "rvm get" I did "rvm get 1.12.0" but still got the error
Then I tried "rvm get 1.11.0" and then presto, my rvm started working again.
I'm not 100% sure what caused the error in the first place but I think it all began when I tried to upgrade rvm with rvm get stable after I was unable to install some gems. I found out that I wasn't able to install gems anymore due to the fact that I had updated my xcode to 4.3.2 and apparently Apple changed their c complier which doesn't play nice with rvm.
Hope this helps someone.
Are you in a gemset? If so, that gem might be in the interpreter's unnamed gemset or the global gemset. If so, try
rvm use 1.9.3
gem uninstall rvm
or
rvm use 1.9.3#global
gem uninstall rvm
I just ran into this error as well. The error you ran into was because of the recent capistrano update. If you add rvm-capistrano to your gemfile and remove the $LOAD-PATH.unshift line from your capistrano deployment file it should work, at least it did for me.
That would be correct. Its in the 'global' gemset. This gemset is 'mixed in' to both the 'default' gemset and any gemsets you actually create.
Thus if you have Ruby 1.9.3 installed, for example, (rvm install 1.9.3) it will be installed into that ruby's 'global'. You can verify this by doing 'gem list rvm -dl' which will show you the name, version, description, and location on the disk of the requested gem.
∴ gem list rvm -dl
*** LOCAL GEMS ***
rvm (1.11.3.3)
Authors: Wayne E. Seguin, Michal Papis
Homepage: https://rvm.beginrescueend.com/
Installed at: /home/me/.rvm/gems/ruby-1.9.3-p194#global
RVM Ruby Gem Library
∴
I don't know why you want it removed, but you would do as Abe stated as the second choice.
To give more details, RVM works with POW, this is known issue: https://github.com/37signals/pow/issues/271
the easiest solution(in project dir):
rvm env . > .powenv
The version of RVM might not be compatible with POW. You can remove RVM and then install the most current version.
The problem is that RVM 1.12 and up does not play well with Capistrano.
So uninstall your RVM, then get RVM 1.11 (rvm get 1.11.0).
Nathan got it right: https://stackoverflow.com/a/10306090/294449
You used to have to do the unshift in your deploy.rb but the latest versions of RVM have made that hack no longer necessary. Just remove it and add the rvm-capistrano gem to your Gemfile. It works like a charm.

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

How do you downgrade rubygems?

I have rubygems 1.3.1 installed but I want to go back to 1.2.0. What's the command to downgrade rubygems?
This worked for me when downgrading from 1.5.2 to 1.4.2 because of old rails version:
sudo gem update --system 1.4.2
More information about downgrading/upgrading rubygems: https://github.com/rubygems/rubygems/blob/master/UPGRADING.md
Updated November 2011: Now that RVM's out, try running rvm install rubygems <version>.
If you're using RVM, then you can do this to remove current ruby gems, then upgrade/downgrade rubygems:
rvm install rubygems 1.4.2
This just worked for me on OSX to get from 1.5.0 back to 1.4.2
sudo gem uninstall -v '1.5.0' rubygems-update
sudo gem update --system --local
I had a similar problem in an old Rails 3 stack. When these type of issues occur, my recommendation is to go onto the production server that the application is currently running in and check out which rubygems version it is using:
gem -v
For me, it was using 1.8.24. So all I needed to do is downgrade my current rubygems which was generated from "rvm install 1.9.3", when I installed the old ruby for this app. I ran the following command:
$ rvm install rubygems 1.8.24 --force
And it worked. Note I am running Ubuntu 14.04 and the server I am using is also Ubuntu.
I used this command to go back to the gem version that my ruby version needed:
rvm rubygems current
If it gives checksum errors try
rvm rubygems current --verify-downloads 1
That did the trick for me.

Resources