Setting up Ruby SDK for RubyMine with Vagrant

This article is about how you can configure to use the Ruby SDK in your Vagrant image with RubyMine.

For this, I have used the joshfng/railsbox Vagrant image because I was using that image for a Rails project.

First you have to find where is your Ruby interpreter located for your project. Let’s assume your project lies in the same folder where you have Vagrantfile. In this case, by default the /vagrant folder in the vagrant image will contain your code.

To find the ruby path, here type which ruby. Then it will spit out the location. You have to remember this location. In my it was ‘/home/vagrant/.rbenv/shims/ruby’.

Now, to link to the vagrant ruby interpreter, you have to open the preferences dialogue and then select Languages & Frameworks > Ruby SDK and Gems.

Then click on + and select remote location as the location and select vagrant.

For the Vagrant path, give the folder where your Vagrantfile is located. For the Ruby interpreter path, give the path you found before.

Click Ok.

Now Rubymine should load up the necessary gems to itself which will take some time. But after that, you should be good to go!