ESP-IDF
ESP-IDF is the official development framework for Espressif SoCs, such as ESP32 and ESP32-S3. ESP-IDF projects use CMake, so you can open, build, flash, and debug them in CLion.
This article uses the led_strip_simple_encoder example from the ESP-IDF repository and an ESP32-S3-DevKitC-1 v1.1 board. The examples are given for macOS. On Windows, the steps are the same except for the differences noted below. On Linux, the steps are similar to those on macOS.
Before you start
Make sure that you have the following:
An ESP32 development board and a USB data cable that fits its connectors.
The ESP-IDF toolchain installed on your machine. To install it, follow the ESP-IDF Get Started guide for your OS. The examples below assume that ESP-IDF is installed in ~/esp/esp-idf.
Configure, build, and debug an ESP-IDF project
Set up a toolchain for the sample project
Launch CLion and click Open on the Welcome screen.
Go to ~/esp/esp-idf/examples/peripherals/rmt/led_strip_simple_encoder and open this directory. The example lights the LED strip with a rainbow chase effect. On a board with a single LED, the LED cycles through colors.
Click Trust Project. For more information, refer to Project security.
CLion opens the Open Project Wizard dialog.

Click Manage toolchains next to the Toolchain field.
Click
and select System. On Windows, select MinGW.

Specify a name for the toolchain, for example,
ESP-IDF.Click Add environment, select From file, and then click Browse.

Select the export.sh file in the ESP-IDF directory, for example, ~/esp/esp-idf/export.sh. On Windows, select export.bat.
Click OK.
In the Open Project Wizard dialog, select your new toolchain. In our example, it is
ESP-IDF.Click OK. CLion loads the CMake project. When the project is loaded, the CMake tool window shows
[Finished].![CMake tool window with the Debug-ESP-IDF profile showing the ESP-IDF project loaded successfully, ending with the [Finished] message. CMake tool window with the Debug-ESP-IDF profile showing the ESP-IDF project loaded successfully, ending with the [Finished] message.](https://resources.jetbrains.com.cn/help/img/idea/2026.3/cl_esp_idf_project_load.png)
If loading fails, select from the main menu.
Build and flash the project
Connect the board to your computer through its UART connector.
Open main/led_strip_example_main.c and set
RMT_LED_STRIP_GPIO_NUMto the GPIO of the LED on your board. On ESP32-S3-DevKitC-1, it is38for board revision v1.1 and48for v1.0:In the run/debug configuration switcher, select flash and click
(Ctrl+F9).

CLion builds the project and flashes the firmware to the board. You can track the progress in the Messages tool window.

Optionally, change the effect:
EXAMPLE_ANGLE_INC_FRAMEcontrols the speed of the chase, andEXAMPLE_ANGLE_INC_LEDcontrols the color density. Then build the flash configuration again.
Debug the project
Connect the board through its USB connector instead of the UART one. ESP32-S3 has a built-in JTAG interface available on this connector. For other chips, check the JTAG setup in the ESP-IDF JTAG debugging guide.
Go to .
Under Debuggers for embedded development, click ESP-IDF. If you already have a debug profile, click
and select ESP-IDF.

For this sample project, the default values work fine. You can enter your own or configure your debug profile in JSON.

Click OK.
In the main toolbar, select the ESP-IDF debug profile and the led_strip_simple_encoder.elf run/debug configuration.

Set a breakpoint in the code and click
(Shift+F9).
CLion starts the session, flashes the firmware, and stops at the breakpoint.

For more information about the debugger features, refer to Start/pause/stop debug session.
Run idf.py commands
ESP-IDF tools that work in the terminal, such as the IDF monitor and the project configuration menu, run through idf.py. To run them from CLion, create a Shell Script run/debug configuration that sources the ESP-IDF environment and then calls idf.py.
Run the IDF monitor
Connect the board through its UART connector.
Select from the main menu.
Click
and select Shell Script.
Specify a name for the configuration, for example,
ESP-monitor. Next to Execute, select Script text and enter a command like this:. ~/esp/esp-idf/export.sh && idf.py -C "$HOME/esp/esp-idf/examples/peripherals/rmt/led_strip_simple_encoder" -p /dev/cu.usbserial-110 flash monitorReplace the following:
~/esp/esp-idf/export.sh: the path toexport.shthat you specified in the toolchain settings.The path after
-C: the path to your project folder.The value after
-p: your board's serial port.
Click OK, then click
(Shift+F10).
CLion flashes the board and shows the monitor output in the terminal.

Open the project configuration menu
The project configuration menu is a terminal-based interface for the Kconfig settings of the project. For the list of options, refer to the Configuration Options Reference.
In the dialog, select the monitor configuration and click Copy Configuration.
Rename the copy, for example, to
ESP-menuconfig, and replaceflash monitorwithmenuconfigin the script text.Click OK, then click
.

Use the keyboard to navigate the menu and change the settings, for example, the flash size in
Serial flasher config|Flash size.
Run other commands
You can also run idf.py commands in the CLion terminal. For example, the following command shows the firmware size: idf.py size

If you use a command frequently, save it as a shell script configuration, as described above.
Known issues
In CLion 2026.3 with ESP-IDF 6.1, clangd computes type sizes for the target correctly. If you see false _Static_assert errors about sizeof (CPP-23731), add --target=riscv32 on a separate line to diagnostig flags in Settings | Languages & Frameworks | C/C++ | Clangd.