How to make SublimeLinter work with Ruby & RVM

If you're using SublimeLinter with Sublime Text 2 on Rails projects using RVM, then you might have noticed some lines are displayed as being errors when they're actually not.

This is because SublimeLinter is using the system ruby, instead of the ruby for your gemset. See, the Ruby linter that SublimeLinter uses is extremely simple. It just runs the code through ruby -wc and marks any output in the code. But that's the problem. Sublime Text 2 isn't using the ruby that your Rails app uses.

You can change the SublimeLinter settings to correct this issue by opening the Sublime Text 2 menu, going into Preferences -> Package Settings -> SublimeLinter, and selecting Settings - User. Add this text to the file, save it, and restart Sublime Text 2:

The old way we had to fix this problem was to go through the package files themselves: