Build, run, debug and test Erlang
warning
The following is only valid when Erlang plugin is installed and enabled.
By default, IntelliJ IDEA uses the built-in Erlang compiler to build Erlang projects. The output of the compilation process is displayed in the Build tool window.
You can also delegate build actions to Rebar. In that scenario, the rebar3 compile
command is executed against your project.
In the main menu, go to Build |
Build Project CtrlF9.
View the output in the Build tool window that appears.

Make sure Rebar3 is installed and configured.
In the Settings dialog (CtrlAlt0S) , navigate to Build, Execution, Deployment | Compiler | Erlang Compiler.
Enable the option called Compile project with rebar.
note
If you need to modify the tool's configuration, click Configure rebar.
In the main menu, go to Build |
Build Project CtrlF9.
View the output in the Build tool window that appears.

IntelliJ IDEA lets you run and debug your Erlang applications in the same way as you would any other application.
note
Create or open an Erlang project.
Double-click the corresponding file in the Project view to open your application in the editor.
Press ShiftF10 to execute the application. Alternatively, click the
icon in the gutter on the left of the editor, and select
Run '<configuration name>' CtrlShiftF10 to execute the function in context.
note
A corresponding Run/Debug Configuration will be created and selected as the current default. You can run it anytime from anywhere in the project by pressing ShiftF10. The default can be changed via the corresponding menu on the Navigation bar.
View the output in the Run tool window that appears.
As an alternative to executing rebar3
commands from the terminal, IntelliJ IDEA provides a way to store each command, or a batch of commands, as a separate modifiable run/debug configuration.
Make sure Rebar3 is installed and configured.
In the main menu, go to Run | Edit Configurations.
In the dialog that appears, click
or press AltInsert to add a new configuration.
Select Erlang Rebar from the menu that appears. An unnamed stub configuration will be created.
In the Command field, specify the
rebar3
commands that you want to run, separated by space, and fill out the rest of the information as needed.Click OK to save the configuration.
note
Configuration that was created or launched last is automatically selected as the current default. You can run it from anywhere in the project by pressing ShiftF10. The default can be changed via the corresponding menu on the Navigation bar.
Click Run |
Run '<configuration name>', or press ShiftF10.
View the output in the Run tool window that appears.
Create or open an Erlang project.
Double-click the corresponding file in the Project view to open your application in the editor. Set breakpoints as necessary.
IntelliJ IDEA debugger requires the Erlang Port Mapper Daemon (EPMD) to be up and running. To get it running, start a random Erlang node on your machine, for instance with the
erl -sname foo -s init stop -noshell
CLI command.Make sure the Add debug info option is enabled in Settings CtrlAlt0S | Compiler | Erlang Compiler.
Press ShiftF9 to start the debugging session. Alternatively, click the
icon in the gutter on the left of the editor, and select
Debug '<configuration name>' to debug the code in context.
note
The corresponding run/debug configuration will be created in this scenario.
View the output and interact with the program data in the Debug tool window that appears.
IntelliJ IDEA provides a way to test Erlang applications using EUnit testing framework.
note
To debug failed tests, use the general debugging procedure.
Create or open an Erlang project.
In the Project view, double-click the file that contains tests to open it in the editor.
Right-click anywhere in the editor window and click
Run '<your_test_name>' (or press CtrlShiftF10) to execute all tests in this file.
Depending on how the project was set up, a corresponding EUnit run configuration will be created for it ad-hoc:
Erlang Eunit for a bare-bones Erlang project.
Erlang Rebar Eunit for a project built with Rebar3.
note
For more information about managing run/debug configurations, refer to the dedicated help section.
In the Test Runner tool window that opens, you can see the output and manage the results of running your tests:
note
For more information about running and debugging tests in IntelliJ IDEA, refer to the dedicated help section.
Thanks for your feedback!