ESP32 — ESP-IDF v6

ESP-IDF v6 — Ubuntu / Linux Setup

Install ESP-IDF v6 on Ubuntu (or any Debian-based Linux) using the ESP-IDF Installation Manager (EIM). EIM handles toolchain, Python environments and all dependencies automatically.


Prerequisites

  • Ubuntu 20.04 LTS, 22.04 LTS, or 24.04 LTS (64-bit)
  • sudo access
  • At least 5 GB of free disk space (8 GB recommended)
  • A stable internet connection (~1.5 GB download)

Python 3.10 minimum

Python 3.10 is the minimum supported version for ESP-IDF v6. EIM checks this automatically. For offline installation, Python 3.11 or newer is required.


Step 1 — Install System Dependencies

Skip if installing EIM via APT

If you plan to install EIM using the Espressif APT repository (Option A in Step 3), you can skip this step — APT handles prerequisites automatically. For other installation methods, install these dependencies first.

Open a terminal and run:

shell
sudo apt update
sudo apt install -y \
  git \
  cmake \
  ninja-build \
  python3 \
  python3-pip \
  python3-venv \
  libffi-dev \
  libssl-dev \
  dfu-util \
  libusb-1.0-0

Step 2 — Add User to dialout Group

This allows your user to access serial ports without sudo:

shell
sudo usermod -aG dialout $USER

Log out and log back in

The group change does not take effect until you log out and log back in (or restart). If you skip this, you will see "Permission denied" when trying to flash your board.

Verify after logging back in:

shell
groups
# Expected output includes: dialout

Step 3 — Install EIM

This is the official Espressif APT repository — the cleanest method for Ubuntu:

shell
# Add the Espressif APT repository
echo "deb [trusted=yes] https://dl.espressif.com/dl/eim/apt/ stable main" | \
  sudo tee /etc/apt/sources.list.d/espressif.list

# Update package lists
sudo apt update

# Install CLI only
sudo apt install eim-cli

# Or install GUI + CLI
sudo apt install eim

Option B — Homebrew (Alternative)

If you use Homebrew on Linux:

shell
# Add the Espressif tap
brew tap espressif/eim

# Install CLI
brew install eim

# Or install GUI (requires a graphical environment)
brew install --cask eim-gui

Option C — Download Binary Directly

shell
# Download latest EIM release for Linux x86_64
curl -LO https://dl.espressif.com/dl/eim/eim-linux-x86_64.tar.gz

# Extract
tar -xzf eim-linux-x86_64.tar.gz

# Move to a directory in your PATH
sudo mv eim /usr/local/bin/

Verify EIM installed correctly:

shell
eim --version

Step 4 — Install ESP-IDF v6 Using EIM

shell
# Install latest stable ESP-IDF with default settings
eim install

# Or use the interactive wizard for custom options
eim wizard

# Install a specific version — for example v6.0.1
eim install -i v6.0.1

A successful installation ends with:

text
INFO - Successfully installed IDF
INFO - Now you can start using IDF tools

Option B — GUI Installation

If you installed the EIM GUI version:

shell
# Launch EIM GUI
eim
  1. Click "New Installation""Start Installation"

First time install

If you have never installed ESP-IDF before, Manage Installations will not be visible. New Installation will be the only available option — that is correct.

  1. Under Easy Installation click "Start Easy Installation"
  2. EIM checks prerequisites — if all pass, click "Start Installation"
  3. Wait for completion — takes 10–20 minutes depending on internet speed
  4. Installation Complete page confirms success

If installation fails

Click Logs at the bottom of EIM to view error details. Resolve the issue and click Try Again. Alternatively use Custom Installation for more control over the installation path and version.


Step 5 — Activate the ESP-IDF Environment

shell
# Activate ESP-IDF in the current terminal session
. $HOME/.espressif/esp-idf-v6.0/export.sh

Verify:

shell
idf.py --version
# Expected: ESP-IDF v6.0.x

Environment is session-scoped

You must run the export.sh script every time you open a new terminal. Use the alias below to make this faster — do not add export.sh directly to .bashrc as it adds startup delay to every terminal.

Create an Alias for Convenience

shell
echo "alias get_idf='. \$HOME/.espressif/esp-idf-v6.0/export.sh'" >> ~/.bashrc
source ~/.bashrc

Now type get_idf in any terminal to activate ESP-IDF instantly.


Step 6 — Verify USB Device Detection

Linux generally includes drivers for CP210x and CH340 out of the box. Connect your ESP32 board via USB and verify it is detected:

shell
ls /dev/ttyUSB* /dev/ttyACM*
# Expected: /dev/ttyUSB0 or /dev/ttyACM0

If the device is not listed, check kernel messages:

shell
dmesg | grep -i "tty\|usb\|ch34\|cp21" | tail -20

For CH340-based boards on some systems, load the driver manually:

shell
# Check if driver is loaded
lsmod | grep ch341

# Load manually if not loaded
sudo modprobe ch341

Step 7 — Build Your First Project

shell
# Activate environment
get_idf

# Navigate to your esp folder
mkdir -p ~/esp && cd ~/esp

# Copy the hello_world example
cp -r $IDF_PATH/examples/get-started/hello_world .
cd hello_world

# Set target chip — change to esp32s3 or esp32c3 if needed
idf.py set-target esp32

# Build
idf.py build

A successful build ends with:

text
Project build complete. To flash, run:
  idf.py flash

Step 8 — Flash and Monitor

Connect your board via USB and identify the port:

shell
ls /dev/ttyUSB* /dev/ttyACM*

Flash and open the serial monitor:

shell
# Replace /dev/ttyUSB0 with your actual port
idf.py -p /dev/ttyUSB0 flash monitor

Expected output:

text
Hello world!
This is esp32 chip with 2 CPU core(s), WiFi/BT/BLE
Restarting in 10 seconds...

To exit the monitor — press Ctrl + ]

🎉 Your ESP-IDF v6.0.1 Ubuntu environment is ready!


Troubleshooting

/dev/ttyUSB0: Permission denied

You have not logged out and back in after adding yourself to the dialout group. Log out and log back in. As a temporary workaround:

shell
sudo chmod 666 /dev/ttyUSB0

eim: command not found

If installed via APT, make sure /usr/bin is in your PATH. If installed via binary download, make sure you moved it to /usr/local/bin/.

idf.py not found after running export.sh

Make sure you ran the script with . (dot space) at the beginning — this sources it into the current shell:

shell
. $HOME/.espressif/esp-idf-v6.0/export.sh

idf.py set-target fails

Run get_idf first to activate the ESP-IDF environment, then retry the command.

Python package installation errors

Make sure python3-venv is installed:

shell
sudo apt install python3-venv

EIM download is slow

Use the Espressif China mirror:

shell
eim install -i v6.0.1 --mirror https://dl.espressif.cn/

Build fails — cmake not found

EIM installs CMake automatically. If it is still missing:

shell
sudo apt install cmake ninja-build

Then re-run get_idf and try building again.


Next Steps

Previous
Windows Setup