Question

I'm trying to install watir. Had to upgrade my ruby installation so I installed rvenv and then used it to install ruby v2.0.

Sagis-MacBook-Air:~ sagism$ rbenv shell 2.0.0-rc2
Sagis-MacBook-Air:~ sagism$ ruby -v
    ruby 2.0.0dev (2013-02-08 trunk 39161) [x86_64-darwin11.4.2]
Sagis-MacBook-Air:~ sagism$ sudo gem install watir
    ERROR:  Error installing watir:
        rubyzip requires Ruby version >= 1.9.2.

I tried to install ruby 1.9.4 but then I get another error which I cannot resolve (different issue).

Was it helpful?

Solution

Make sure that you ruby environment isn't dropped by sudo command:

$ sudo ruby -v

ruby 2.0.0dev (2013-02-08 trunk 39161) [x86_64-darwin11.4.2]

If your environment has reset:

$ sudo ruby -v

ruby 1.8.7 [x86_64-darwin11.4.2]

Add into /etc/sudoers string like follows, and be sure that you are in wheel group:

User_Alias WHEEL_USERS = %wheel
Defaults:WHEEL_USERS !env_reset

Of course you can do it for any group you wish, this should prevent to drop the current environment, when you have to sudo, then try again:

$ sudo ruby -v

ruby 2.0.0dev (2013-02-08 trunk 39161) [x86_64-darwin11.4.2]

OTHER TIPS

sudo update-alternatives --config gem

and select the correct version

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top