1

I have multiple versions of Ruby installed on my machine. By using RVM, I am able to use Ruby 1.9.2 on the terminal. But whenever, I use Sublime Text, the text editor of my choice, it defaults to using Ruby 1.8.7. How do i change this behavior?

  • you need to make sure that your ruby install is the first one found in the path, otherwise it won't be picked up. Or you can specify the absolute path to the installation you want (e.g. /usr/local/bin/ruby for homebrew). – XQYZ Jun 8 '12 at 14:09
2

This worked for me.

Update ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Ruby/Ruby.sublime-build

{
  "env":{
      "PATH":"${HOME}/.rvm/bin:${PATH}"
  },
  "cmd": ["rvm-auto-ruby", "$file"],
  "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
  "selector": "source.ruby"
}

The env part will add rvm-auto-ruby into the $PATH and the cmd will execute rvm-auto-ruby yourfile.rb when you press Cmd-B. You and add options in between rvm-auto-ruby if you want, like this `”cmd”: [“rvm-auto-ruby”, “-S”, “$file”].

From here:
http://rubenlaguna.com/wp/2012/12/07/sublime-text-2-rvm-rspec-take-2/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .