As I’m transitioning most of my code to Ruby 1.9.2 (using RVM to manage my gems), I have been seeing this error a lot:
/usr/bin/ruby: illegal switch in RUBYOPT: -o (RuntimeError)
Awful isn’t it? What’s happening?
When you are running Ruby 1.9.2+ in RVM, the RUBYOPT environment variable is set to “-r openssl”. This is interpreted by 1.8.7 and below as “-o” which it doesn’t understand, of course. The trick is to set RUBYOPT=”“. You can do this automatically by pasting the following code ot the END of the ~/.rvm/hooks/after_use script:
1 2 3 4 5 | |
There are some use-cases that require you to run the export command manually, for example when
you are dealing with Homebrew, which runs on the system Ruby if you use their
standard install script. In that case just type export RUBYOPT= into the
command prompt, hit enter, and continue with what you were doing.
See the answer on Stack Overflow: http://stackoverflow.com/questions/6117302/how-to-set-rubyopt-for-only-specific-rvm-versions