Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer 1

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/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.