Bundler - how to re-install all gems after os update?

201 views
Skip to first unread message

Colin Law

unread,
Feb 6, 2012, 4:18:53 PM2/6/12
to rubyonra...@googlegroups.com
I had a working Rails setup using RVM on Ubuntu 11.10 with /home on a
separate partition. I installed Ubuntu 12.04 (Alpha) on the root
partition, leaving the home partition unchanged. I now find that some
things don't work, I think due to the fact that the system has been
updated and versions of libraries have changed. For example I get:

$ rails c
/home/colinl/.rvm/gems/ruby-1.8.7-p302/gems/mysql2-0.3.10/lib/mysql2/mysql2.so:
libmysqlclient_r.so.16: cannot open shared object file: No such file
or directory - /home/colinl/.rvm/gems/ruby-1.8.7-p302/gems/mysql2-0.3.10/lib/mysql2/mysql2.so
(LoadError)

I uninstalled gem mysql2 then did bundle install, which re-installed
mysql2 (the same version) with its native extensions and this fixed
the problem. I think (but may be corrected) that I need to re-install
any gems that have native extensions in each of my projects. As I
don't know which have native extensions what I would like to do is
just to remove them all and then run bundle install to reinstall them.
I can't find a method of uninstalling them however. Any suggestions?

Colin

Peter Vandenabeele

unread,
Feb 6, 2012, 4:31:16 PM2/6/12
to rubyonra...@googlegroups.com
Hi Colin,

If I understand your request correctly, you are asking for
`rvm gemset empty <gemset name>`  ? Or did I misunderstand?

Below I show a log of `bundle install`, `rvm gemset empty` and `bundle install`

HTH,

Peter

=====================

peterv@ASUS:~/b/github/petervandenabeele$ cd shoes/

peterv@ASUS:~/b/github/petervandenabeele/shoes$ rvm current
ruby-1.9.3-p0@shoes

peterv@ASUS:~/b/github/petervandenabeele/shoes$ gem list

*** LOCAL GEMS ***

bundler (1.0.21)
rake (0.9.2.2)

peterv@ASUS:~/b/github/petervandenabeele/shoes$ bundle install
Fetching source index for http://rubygems.org/
Installing rake (0.9.2) 
Installing builder (3.0.0) 
Installing diff-lcs (1.1.3) 
Installing json (1.6.1) with native extensions 
Installing gherkin (2.5.1) with native extensions 
Installing term-ansicolor (1.0.6) 
Installing cucumber (1.1.0) 
Installing net-http-digest_auth (1.1.1) 
Installing net-http-persistent (1.9) 
Installing nokogiri (1.5.0) with native extensions 
Installing webrobots (0.0.11) 
Installing mechanize (2.0.1) 
Installing rspec-core (2.6.4) 
Installing rspec-expectations (2.6.0) 
Installing rspec-mocks (2.6.0) 
Installing rspec (2.6.0) 
Installing shoes-mocks (0.0.2) 
Installing shoes-cucumber (0.0.2) 
Using bundler (1.0.21) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

peterv@ASUS:~/b/github/petervandenabeele/shoes$ rvm current
ruby-1.9.3-p0@shoes

peterv@ASUS:~/b/github/petervandenabeele/shoes$ bundle show rspec
/home/peterv/.rvm/gems/ruby-1.9.3-p0@shoes/gems/rspec-2.6.0

peterv@ASUS:~/b/github/petervandenabeele/shoes$ rvm gemset empty shoes
Are you SURE you wish to remove the installed gems for gemset 'ruby-1.9.3-p0@shoes' (/home/peterv/.rvm/gems/ruby-1.9.3-p0@shoes)?
(anything other than 'yes' will cancel) > yes

peterv@ASUS:~/b/github/petervandenabeele/shoes$ rvm current
ruby-1.9.3-p0@shoes

peterv@ASUS:~/b/github/petervandenabeele/shoes$ gem list

*** LOCAL GEMS ***

bundler (1.0.21)
rake (0.9.2.2)

peterv@ASUS:~/b/github/petervandenabeele/shoes$ bundle install
Fetching source index for http://rubygems.org/
Installing rake (0.9.2) 
Installing builder (3.0.0) 
Installing diff-lcs (1.1.3) 
Installing json (1.6.1) with native extensions 
Installing gherkin (2.5.1) with native extensions 
Installing term-ansicolor (1.0.6) 
Installing cucumber (1.1.0) 
Installing net-http-digest_auth (1.1.1) 
Installing net-http-persistent (1.9) 
Installing nokogiri (1.5.0) with native extensions 
Installing webrobots (0.0.11) 
Installing mechanize (2.0.1) 
Installing rspec-core (2.6.4) 
Installing rspec-expectations (2.6.0) 
Installing rspec-mocks (2.6.0) 
Installing rspec (2.6.0) 
Installing shoes-mocks (0.0.2) 
Installing shoes-cucumber (0.0.2) 
Using bundler (1.0.21) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Colin Law

unread,
Feb 6, 2012, 4:45:32 PM2/6/12
to rubyonra...@googlegroups.com
On 6 February 2012 21:31, Peter Vandenabeele <pe...@vandenabeele.com> wrote:
> On Mon, Feb 6, 2012 at 10:18 PM, Colin Law <cla...@googlemail.com> wrote:
>>
>> I had a working Rails setup using RVM on Ubuntu 11.10 with /home on a
>> separate partition.  I installed Ubuntu 12.04 (Alpha) on the root
>> partition, leaving the home partition unchanged.  I now find that some
>> things don't work, I think due to the fact that the system has been
>> updated and versions of libraries have changed.  For example I get:
>>
>> $ rails c
>>
>> /home/colinl/.rvm/gems/ruby-1.8.7-p302/gems/mysql2-0.3.10/lib/mysql2/mysql2.so:
>> libmysqlclient_r.so.16: cannot open shared object file: No such file
>> or directory -
>> /home/colinl/.rvm/gems/ruby-1.8.7-p302/gems/mysql2-0.3.10/lib/mysql2/mysql2.so
>> (LoadError)
>>
>> I uninstalled gem mysql2 then did bundle install, which re-installed
>> mysql2 (the same version) with its native extensions and this fixed
>> the problem.  I think (but may be corrected) that I need to re-install
>> any gems that have native extensions in each of my projects.  As I
>> don't know which have native extensions what I would like to do is
>> just to remove them all and then run bundle install to reinstall them.
>>  I can't find a method of uninstalling them however.  Any suggestions?
>
>
> Hi Colin,
>
> If I understand your request correctly, you are asking for
> `rvm gemset empty <gemset name>`  ? Or did I misunderstand?

That's the one, thanks. I was looking for it as part of bundle but
you are right, emptying the gemset is what I want to do.

>
> Below I show a log of `bundle install`, `rvm gemset empty` and `bundle
> install`

After the empty I had to "gem install bundler" before "bundle install"
as it took that out too. Otherwise exactly as you show. Many thanks

Colin

Peter Vandenabeele

unread,
Feb 6, 2012, 5:14:44 PM2/6/12
to rubyonra...@googlegroups.com
On Mon, Feb 6, 2012 at 10:45 PM, Colin Law <cla...@googlemail.com> wrote:
> Below I show a log of `bundle install`, `rvm gemset empty` and `bundle
> install`

After the empty I had to "gem install bundler" before "bundle install"
as it took that out too.  Otherwise exactly as you show.

That's because I installed the "bundler" gem in my "global" gemset (IIRC).
So, when I create a new gemset, the new gemset automatically has
2 gems it reuses from that global gemset. It's a neat trick :-)

peterv@ASUS:~$ rvm gemset use global
Using /home/peterv/.rvm/gems/ruby-1.9.3-p0 with gemset global

peterv@ASUS:~$ gem list

*** LOCAL GEMS ***

bundler (1.0.21)
rake (0.9.2.2)

peterv@ASUS:~$ rvm gemset create new_gemset
'new_gemset' gemset created (/home/peterv/.rvm/gems/ruby-1.9.3-p0@new_gemset).

peterv@ASUS:~$ rvm gemset use new_gemset
Using /home/peterv/.rvm/gems/ruby-1.9.3-p0 with gemset new_gemset

peterv@ASUS:~$ gem list

*** LOCAL GEMS ***

bundler (1.0.21)
rake (0.9.2.2)


Many thanks


You're very welcome,

Peter
Reply all
Reply to author
Forward
0 new messages