2

I installed rvm and then installed bropages in @global gemset.

$ rvm install 2.2.3
$ rvm use ruby-2.2.3@global
$ gem install bropages

When I run

$ gem list | grep bro
bropages (0.1.0)

I can see bropages is installed. But when I move to default gemset it is not available.

$ rvm use ruby-2.2.3@default
$ gem list | grep bro # Result is empty

I also tried official way.

$ rvm ruby-2.2.3@global do gem install bropages
Successfully installed bropages-0.1.0
Parsing documentation for bropages-0.1.0
Done installing documentation for bropages after 0 seconds
1 gem installed

But it too didn't work.

Running bro command in default gemset gives this error,

$ bro
/Users/andy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bropages' (>= 0) among 7 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/andy/.rvm/gems/ruby-2.2.3 /Users/andy/.rvm/gems/ruby-2.2.3@global:/Users/andy/.rvm/gems/ruby-2.2.3', execute `gem env` for more information
    from /Users/andy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/andy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /Users/andy/.rvm/gems/ruby-2.2.3@global/bin/bro:22:in `<main>'

I have tried these links but they didn't help at all.

  1. How to install gem across all gemsets when using RVM
  2. RVM - Not able to use gems from the @global gemset
  3. How do I use RVM and create globally available gems?

Ruby 2.2.3 is the only version installed. My shell is Fish.


From comment

from the default gemset run: echo $GEM_HOME - $GEM_PATH from the global gemset run: gem list -d bro

Output is as follows,

$ rvm use ruby-2.2.3@default
Using /Users/andy/.rvm/gems/ruby-2.2.3
$ echo $GEM_HOME - $GEM_PATH
/Users/andy/.rvm/gems/ruby-2.2.3 - /Users/andy/.rvm/gems/ruby-2.2.3 /Users/andy/.rvm/gems/ruby-2.2.3@global

$ rvm use ruby-2.2.3@global
Using /Users/andy/.rvm/gems/ruby-2.2.3 with gemset global
$ gem list -d bro

*** LOCAL GEMS ***

bropages (0.1.0)
    Author: bropages.org
    Homepage: http://bropages.org
    Installed at: /Users/andy/.rvm/gems/ruby-2.2.3@global

    Bro
Community
  • 1
  • 1
Andrew-Dufresne
  • 5,464
  • 7
  • 46
  • 68
  • from the default gemset run: `echo $GEM_HOME - $GEM_PATH` from the global gemset run: `gem list -d bro` – mpapis Sep 11 '15 at 21:44
  • @mpapis I have updated the question with output. – Andrew-Dufresne Sep 11 '15 at 21:57
  • your `$GEM_PATH` is set wrong, it has a space instead of colon – mpapis Oct 18 '15 at 23:05
  • @mpapis there was a bug in the rvm recommended script for fish shell. See my comment [here](https://stackoverflow.com/questions/32529350/gem-installed-in-global-gemset-is-not-available-in-other-gemsets?noredirect=1#comment53005059_32569530). – Andrew-Dufresne Oct 19 '15 at 14:17

1 Answers1

2

looks like your GEM_PATH is broken, pleas run:

export GEM_PATH=/Users/andy/.rvm/gems/ruby-2.2.3:/Users/andy/.rvm/gems/ruby-2.2.3@global

and try again:

bro
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Thanks. Replacing ` ` in `GEM_PATH` with `:` fixed the issue for me. This raises another problem, every time I install a ruby, rvm sets `GEM_PATH` incorrectly. Can you please tell me where does rvm set `GEM_PATH` so that I can fix the issue for all rubies? – Andrew-Dufresne Sep 14 '15 at 21:56
  • I think this issue is due to using rvm in fish shell. I installed a new ruby version in bash shell, and rvm set `GEM_PATH` correctly. But when I install ruby in the fish shell, the `:` in `GEM_PATH is replaced with ` `, which then breaks the gems. – Andrew-Dufresne Sep 14 '15 at 22:03
  • rvm [official documentation](https://rvm.io/integration/fish) recommends [this script](https://github.com/lunks/fish-nuggets/blob/master/functions/rvm.fish) for fish shell. I suspect this line is the culprit https://github.com/lunks/fish-nuggets/blob/master/functions/rvm.fish#L7 – Andrew-Dufresne Sep 14 '15 at 22:35
  • Ok so this issue has already been noticed and fixed here https://github.com/lunks/fish-nuggets/pull/16 – Andrew-Dufresne Sep 14 '15 at 22:50
  • The patch was not accepted into the upstream when I created this question. The patch fixes the issue. – Andrew-Dufresne Sep 14 '15 at 22:50