Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I setup the ruby SDK in IntelliJ IDEA?

I've been using this guide

Whenever I go to import the module I get this screen:

enter image description here

I used the following file path, maybe this is whats wrong? /usr/local/Cellar/ruby-build/20160130/share/ruby-build/2.3.0

And got this error:

enter image description here

I'd appreciate any ideas anyone might have, i've been trying get this working all night!

like image 520
thesowismine Avatar asked Feb 03 '16 07:02

thesowismine


2 Answers

I was able to solve this by doing:

Preferences | Plugins | Install JetBrains plugin

enter image description here

like image 100
thesowismine Avatar answered Sep 17 '22 15:09

thesowismine


I ran into this problem with Intellij IDEA 2020.2. It took a while to resolve because the Intellij documentation seems to be missing one critical piece.

When you first open a project in IDEA, it assumes all your code is part of a Java module. With that module in place you cannot set a Ruby SDK at the module level. There's no option to do because the existing module is configured as Java.

Here's a screenshot of my example project with the default Java module. Notice the icon is a folder with a blue rectangle in the lower, right corner.

screenshot of Project Structure with default Java module

Here's what I had to do.

  1. Open the Project Structure dialog (File | Project Structure).

  2. In the Modules settings, highlight the top-level project module and click the delete button (looks like a minus sign).

  3. Click the plus sign to add a new module.

  4. From the pop-up click "New Module".

  5. In the "New Module" pop-up select Ruby and the correct Module SDK (e.g. rbenv: 2.5.0)

  6. When you are prompted to enter the Module name, Content root, and Module file location, make sure the directories are set to your project's root. When I entered the module name it appended the name to the project's root directory which is probably not what you want.

Once you've done that the module should appear with a Ruby icon on it and the rest should work as documented here: https://www.jetbrains.com/help/idea/configuring-language-interpreter.html

Here's a screenshot of my new Ruby module. You can see the Ruby icon replaced the blue rectangle.

screenshot of Project Structure with Ruby module

I hope this saves you some time!

like image 42
Doug Couvillion Avatar answered Sep 17 '22 15:09

Doug Couvillion