Cannot execute RVM shell commands in ruby Cannot execute RVM shell commands in ruby shell shell

Cannot execute RVM shell commands in ruby


As it happens, RVM actually exposes a Ruby API that's included by default. Add $HOME/.rvm/lib to your $LOAD_PATH; you can now use require 'rvm'.

As far as I can tell, the main documentation for this is in the source files themselves (a summary is in rvm.rb).

Now you can write Ruby scripts that manipulate RVM, like this:

require 'rvm'env = RVM.currentenv.gemset.create('newgemset')

And so on.


Call bash with the -c parameter:

command = 'source ~/.rvm/scripts/rvm; type rvm | head -1'exec "bash -c #{command.inspect}"