Sublime Text 2, rbenv, osx and the build command

I’ve recently started using rbenv on OSX and was having some trouble getting the cmd+b build command in Sublime Text 2 working.

Specifically, it seemed that the wrong ruby version was being used. This caused my require ” statements to fail since it couldnt find the gems I thought I had installed.

To get things working, simply edit Ruby.sublime-build (Browse Packages -> Ruby) and update the “cmd” value to point to ~/.rbenv/shims/ruby

{
	// These are the old commands
	//"cmd": ["ruby", "$file"], 
	//"cmd": ["/usr/local/bin/ruby", "$file"],
	"cmd": ["/Users/kiwidev/.rbenv/shims/ruby", "$file"],	
	"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
	"selector": "source.ruby"
}
Advertisements

2 thoughts on “Sublime Text 2, rbenv, osx and the build command

    • If it doesn’t work for you, make sure you don’t have a .ruby-version file in the same directory as the file you’re trying to build.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s