Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Ruby version used in Sublime

How do you change the Ruby version Sublime uses while testing. It is currently using 1.8, but I want it to use 1.9.3 which is set to my default in RVM. When I type which ruby, I get 1.9.3, but Sublime is not using it.

like image 557
SilverNightaFall Avatar asked Jun 22 '12 18:06

SilverNightaFall


People also ask

How do I specify Ruby version?

To set a default Ruby version with rvm, enter rvm --default use 3.0. 0 on the command line. To switch to the system ruby, enter rvm use system . To switch back to the default, rvm default .

Does Sublime Text support Ruby?

Alternatively you can run it right there in Sublime Text. Make sure you're in Ruby mode by clicking on the language selector in the bottom-right corner of the screen. From then on, you can run it right there in Sublime by pressing Tools -> Build, or using the CTRL-B hotkey.


1 Answers

From this gist: https://gist.github.com/fny/8008316

Include the configuration below in the appropriate file as listed here:

  • OS X ST2: ~/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.sublime-build
  • OS X ST3: ~/Library/Application Support/Sublime Text 3/Packages/User/Ruby.sublime-build
  • Linux ST2: ~/.config/sublime-text-2/Packages/Ruby/Ruby.sublime-build
  • Linux ST3: ~/.config/sublime-text-3/Packages/User/Ruby.sublime-build

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

like image 158
fjuan Avatar answered Sep 30 '22 19:09

fjuan