IntelliJ IDEA 2021.2 Help

Initial Configuration

Install and enable the plugin

  1. In the Settings/Preferences dialog Ctrl+Alt+S, select the Plugins section on the left.

  2. Switch to the Marketplace tab at the top and search for a plugin called Erlang.

  3. Once the plugin is found, click Install, apply the changes, and close the dialog. Restart the IDE if prompted.

    Installing the Erlang plugin

Install Erlang/OTP framework

Erlang/OTP is a set of Erlang libraries and design principles essential for development.

To install Erlang/OTP, follow the instructions below that correspond to your OS:

  • Download the Erlang/OTP package and run the installation wizard. Take a note of the installation folder path.

    Once the installation is over, add the <installation folder>\bin path to the PATH environment variable:

    Adding Erlang to PATH

    To verify that Erlang/OTP is installed correctly, do either of the following:

    • Type "erl" in the command prompt to start up the Erlang shell:

      Verifying the Erlang OTP is installed correctly
    • Run the Erlang Emulator (<installation folder>\bin\werl.exe). This will start Erlang in its own window, with fully functioning command-line editing and scrollbars.

    Run the following command in the terminal:

    • Using Homebrew:

      brew install erlang
    • Using MacPorts:

      sudo port install erlang +ssl

    To verify that Erlang/OTP is installed correctly, start up the Erlang shell from the terminal using the erl command:

    Verifying the Erlang OTP is installed correctly
    • For Ubuntu/Debian:

      sudo apt-get update sudo apt-get install erlang
    • For Fedora:

      sudo yum install erlang
    • For FreeBSD:

      sudo pkg update sudo pkg install erlang

    To verify that Erlang/OTP is installed correctly, start up the Erlang shell from the terminal using the erl command:

    Verifying the Erlang OTP is installed correctly

    Install and configure Rebar

    Rebar3 Logo

    In addition to Erlang/OTP, you will also need Rebar3: a build tool that helps compile and test Erlang applications. It is the spiritual successor to rebar (v2.x), which is now deprecated.

    Rebar3 comes in the form of a portable executable escript file which can be used either as is (script version) or as a means to install a faster, fully compiled form of Rebar3.

    The process of installing Rebar3 from source, as well as other ways to install and run it are described at length in the tool's official documentation.

    The latest stable release of the escript can be downloaded in one of the two ways:

    • Directly from the official Rebar3 website.

    • From IntelliJ IDEA:

      1. Settings / Preferences Ctrl+Alt+S | (Other Settings) | Erlang External Tools

      2. Click 'Download the latest Rebar 3'

      3. Select the directory where you want the downloaded escript to be saved.

    Specifying the path to the Rebar3 executable in the Erlang External Tools dialog will allow you to create new Rebar run/debug configurations and execute existing ones:

    Locating Rebar executable

    Configure the IDE to work with Erlang SDK

    The last step of the initial configuration is to let IntelliJ IDEA know where the Erlang SDK is located on your computer.

    1. Once your project is opened, go to the Project Structure dialog Ctrl+Alt+Shift+S

    2. In the SDKs section, click + to add a new SDK, then select Add Erlang SDK

    3. In the file chooser dialog that appears, select the directory where you installed Erlang/OTP, for example C:\Program Files (x86)\erl23.3.

      The SDK will be detected and displayed on the list of available SDKs, its lib folder automatically added to the classpath.

      Configuring the Erlang SDK

    If you don’t know where Erlang OTP was installed, check the following directories:

    • OS

      Path

      Windows

      C:\Program Files (x86)\erl<version>

      Linux

      /usr/lib/erlang/<version>

      MacPorts, macOS

      /opt/local/lib/erlang/<version>

      Homebrew, macOS

      /usr/local/Cellar/erlang/<version>

    Last modified: 02 August 2022