ruby gem install to 1.9.1 instead of 1.8

0

I ran the following lines in linux

gem install mysql

And it installed the mysql gem to /var/lib/gems/1.8/gems. That's not where I want it. I wnat it at /var/lib/gems/1.9.1/gems. I could just copy the files over to the 1.9.1 gems directory. But is there an option in the gem install mysql command that lets me install the gem to 1.9.1 instead of 1.8?

John

Posted 2015-05-31T17:39:07.563

Reputation: 673

Which Linux distribution are you using? Are both versions of Ruby properly installed? – Daniel B – 2015-05-31T20:36:47.877

I'm using ubuntu 14.04. Both versions of ruby are working fine, except 1.9.1 is missing the mysql gem. – John – 2015-05-31T22:01:04.847

Answers

0

Normally, the default version of Ruby on Ubuntu 14.04 would be 1.9.1. I don’t know what’s wrong with your system in that regard.

If you want to target a specific Ruby version, simply use the fully qualified name:

gem1.9.1 install mysql

Likewise, you can use ruby1.9.1 to explicitly request the Ruby 1.9.1 interpreter.

Daniel B

Posted 2015-05-31T17:39:07.563

Reputation: 40 502

-1

FROM gem help examples:

  • Install 'rake', but only version 0.3.1, even if dependencies are not met, and into a user-specific directory:

    gem install rake --version 0.3.1 --force --user-install {/var/lib/gems/... in your case)

linuxdev2013

Posted 2015-05-31T17:39:07.563

Reputation: 1 051

That’s not a proper way to solve this problem. If native extensions are required, they have to be compiled against the correct Ruby version. – Daniel B – 2015-05-31T20:36:19.193