You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by sebb <se...@gmail.com> on 2016/03/07 16:41:39 UTC

Problems with gem library path when using bundle

I have two ruby installations on MacOSX; 2.3.0 (/usr/local/bin/ruby)
and 2.0.0 (/usr/bin/ruby)

Since installing 2.3.0 and making it the default, ruby can no longer
find most of the gems.

This is because the gem environment is different for 2.3.0.

I tried using bundle install, but that does not seem to take any
notice of the gem environment.

Any idea how to fix it so bundle picks up the correct environment?

Re: Problems with gem library path when using bundle

Posted by sebb <se...@gmail.com>.
On 7 March 2016 at 17:57, Sam Ruby <ru...@intertwingly.net> wrote:
> On Mon, Mar 7, 2016 at 10:41 AM, sebb <se...@gmail.com> wrote:
>> I have two ruby installations on MacOSX; 2.3.0 (/usr/local/bin/ruby)
>> and 2.0.0 (/usr/bin/ruby)
>>
>> Since installing 2.3.0 and making it the default, ruby can no longer
>> find most of the gems.
>>
>> This is because the gem environment is different for 2.3.0.
>>
>> I tried using bundle install, but that does not seem to take any
>> notice of the gem environment.
>>
>> Any idea how to fix it so bundle picks up the correct environment?
>
> It is not clear to me how you installed 2.3.0, or what your intent is.

brew install ruby

> So I'll give multiple answers, pick the one that works best for you.
> :-)

Thanks.

> 1) I would like everything on Whimsy to be able to work with the
> default version of Ruby on popular environments like Mac OS/X and
> Ubuntu.  So 1.9.3(*) or above should be fine for now.  Deployment is a
> different matter; 2.3.0 has better garbage collection so should do
> better for long running tasks.
>
> 2) If you really want to have multiple Rubies and switch between them,
> you really should look into rvm or rbenv (I prefer rvm, but most Mac
> users tend to gravitate to rbenv).
>
> 3) You indicated that you want to make 2.3.0 your default.  That
> should be fine, but apparently you haven't updated gems?  Some
> commands to try:

PATH is set so that /usr/local/bin is before /usr/bin so ruby 2.3.0 is
found before 2.0.0
That appears to work fine apart from the missing gems.

> $ which gem

/usr/local/bin/gem

> $ gem env
>
> $ ruby -e "p Gem.paths.home"
>
> $ ruby -e "p Gem.default_path"

These all show 2.3.0 for the Gem paths.

However bundle finds the existing gems in the 2.0.0 path and does not
try to install anything in the 2.3.0 paths.

I would expect bundle to use the gem env to decide where to install things.
However it does not seem to.

[Later]

I just realised that bundle is not one of the gems in 2.3.0, so I have
just installed it.
This seems to have fixed the issue.

> - Sam Ruby
>
> (*) Note Ubuntu refers to this as 1.9.1 for bizarre historical
> reasons.  Whimsy-vm2 is running ruby 1.9.3p484.

Re: Problems with gem library path when using bundle

Posted by Sam Ruby <ru...@intertwingly.net>.
On Mon, Mar 7, 2016 at 10:41 AM, sebb <se...@gmail.com> wrote:
> I have two ruby installations on MacOSX; 2.3.0 (/usr/local/bin/ruby)
> and 2.0.0 (/usr/bin/ruby)
>
> Since installing 2.3.0 and making it the default, ruby can no longer
> find most of the gems.
>
> This is because the gem environment is different for 2.3.0.
>
> I tried using bundle install, but that does not seem to take any
> notice of the gem environment.
>
> Any idea how to fix it so bundle picks up the correct environment?

It is not clear to me how you installed 2.3.0, or what your intent is.
So I'll give multiple answers, pick the one that works best for you.
:-)

1) I would like everything on Whimsy to be able to work with the
default version of Ruby on popular environments like Mac OS/X and
Ubuntu.  So 1.9.3(*) or above should be fine for now.  Deployment is a
different matter; 2.3.0 has better garbage collection so should do
better for long running tasks.

2) If you really want to have multiple Rubies and switch between them,
you really should look into rvm or rbenv (I prefer rvm, but most Mac
users tend to gravitate to rbenv).

3) You indicated that you want to make 2.3.0 your default.  That
should be fine, but apparently you haven't updated gems?  Some
commands to try:

$ which gem

$ gem env

$ ruby -e "p Gem.paths.home"

$ ruby -e "p Gem.default_path"

- Sam Ruby

(*) Note Ubuntu refers to this as 1.9.1 for bizarre historical
reasons.  Whimsy-vm2 is running ruby 1.9.3p484.