Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using RVM, bundler does not install in proper gemset when gems are installed in a different ruby version

Tags:

ruby

rvm

bundler

I am having trouble with rvm, bundler and gemsets. I have 3 rubies installed in rvm:

rvm rubies

   macruby-0.7.1 [ x86_64 ]
   ree-1.8.7-2010.02 [ x86_64 ]
=> ruby-1.9.2-p0 [ x86_64 ]

And gemsets like so:

rvm gemsets

   macruby-0.7.1 [ x86_64 ]
   ree-1.8.7-2010.02 [ x86_64 ]
   ree-1.8.7-2010.02@chef [ x86_64 ]
   ree-1.8.7-2010.02@global [ x86_64 ]
   ree-1.8.7-2010.02@mobi [ x86_64 ]
   ree-1.8.7-2010.02@temple_rails [ x86_64 ]
   ruby-1.9.2-p0 [ x86_64 ]
=> ruby-1.9.2-p0@instapaper [ x86_64 ]
   ruby-1.9.2-p0@mobi [ x86_64 ]

I have a .rvmrc that switches to ruby 1.9.2 and the "instapaper" gemset:

rvm use ruby-1.9.2-p0@instapaper

I want to use bundler, so I manually install bundler in this gemset and that works fine.

I build my Gemfile:

source "http://rubygems.org"
gem "mechanize"
gem "highline"
gem "www-delicious"

Then when I run "bundle install" it uses the gems it sees in ree 1.8.7:

Using highline (1.6.1) 
Using nokogiri (1.4.4) 
Using mechanize (1.0.0) 
Using www-delicious (0.4.0) 
Using bundler (1.0.7) 
Your bundle is complete! It was installed into /Users/kold/.rvm/gems/ree-1.8.7-2010.02

If I run "rvm info" it spits out all the right information and I'm even able to install a gem manually without issue:

kold@Kevin-Olds-MacBook-Pro [master*]$ rvm info

ruby-1.9.2-p0@instapaper:

  system:
    uname:       "Darwin Kevin-Olds-MacBook-Pro.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.1.0 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p0"
    date:         "2010-08-18"
    platform:     "x86_64-darwin10.4.0"
    patchlevel:   "2010-08-18 revision 29036"
    full_version: "ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]"

  homes:
    gem:          "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper"
    ruby:         "/Users/kold/.rvm/rubies/ruby-1.9.2-p0"

  binaries:
    ruby:         "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/ruby"
    irb:          "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/irb"
    gem:          "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/gem"
    rake:         "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/rake"

  environment:
    PATH:         "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper/bin:/Users/kold/.rvm/gems/ruby-1.9.2-p0@global/bin:/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin:/Users/kold/.rvm/bin:/usr/local/bin:/usr/local/mysql/bin:/opt/local/bin:/Users/kold/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
    GEM_HOME:     "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper"
    GEM_PATH:     "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper:/Users/kold/.rvm/gems/ruby-1.9.2-p0@global"
    MY_RUBY_HOME: "/Users/kold/.rvm/rubies/ruby-1.9.2-p0"
    IRBRC:        "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/.irbrc"
    RUBYOPT:      ""
    gemset:       "instapaper"

I'm just not sure why it's installing these gems outside of the gemset.

Update 1:

$ rvm use ruby-1.9.2-p0@instapaper && which bundle
Using /Users/kold/.rvm/gems/ruby-1.9.2-p0 with gemset instapaper
/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper/bin/bundle

kold@Kevin-Olds-MacBook-Pro [master*]$ bundle --verbose check
Using highline (1.6.1) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/highline-1.6.1.gemspec 
Using nokogiri (1.4.4) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/nokogiri-1.4.4.gemspec 
Using mechanize (1.0.0) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/mechanize-1.0.0.gemspec 
Using www-delicious (0.4.0) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/www-delicious-0.4.0.gemspec 
Using bundler (1.0.7) from /Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper/gems/bundler-1.0.7/lib/bundler 
Your bundle is complete! It was installed into /Users/kold/.rvm/gems/ree-1.8.7-2010.02
like image 541
Kevin Old Avatar asked Dec 11 '10 02:12

Kevin Old


People also ask

Is bundler installed with Ruby?

As a rule, the installed Ruby interpreter comes with Bundler installed. If not, you can install Bundler to the project SDK in one of the following ways: Select Tools | Bundler | Install Bundler from the main menu.

How do I add Gemset to RVM?

Step 1: rvm gemset create [name of gemset] Step 2: rvm --rvmrc [ruby version here]@[name of gemset] # Note: You can check your current ruby version by running "ruby -v" from your console. Step 3: Refresh your directory. # You can simply do this by checking out of your directory and going back to that directory again.

What is Gemset Ruby?

Gemsets are little libraries for individual projects, where each gem used in the project is stored. You tell Ruby which gems you need for a project, and it stores them in a gemset so you can quickly switch project to project and have all the gems you need (and only the gems you need for each project).


1 Answers

After talking with "indirect" on #bundler on IRC we determined that my BUNDLE_PATH was set to /Users/kold/.rvm/gems/ree-1.8.7-2010.02. Once I did a unset BUNDLE_PATH everything worked as it should!

like image 177
Kevin Old Avatar answered Sep 29 '22 17:09

Kevin Old