In this episode we will learn how to code, build, flash, monitor and debug the Espressif chips like ESP32 using ESP-IDF (IoT Development Framework) and Visual studio code.
In this article we will use MacBook pro with MacOS BigSur v11.2.3 as our development machine, let’s start.
Prerequisites for MacOS
Before getting started with the Visual Studio Code setup for ESP IDF environment we will need to install following tools on our machine.
Python 3.5
Please note that MacOS comes with Python 2.7 installed out of the box. We will use HomeBrew ti install Python 3 on our machine, run following command from a Terminal if you do not have installed it already.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Run following command to install Python 3 using Homebrew.
brew install python
Homebrew will also install pip pointing to newly installed hombrew version of python. Run following commands to verify installation of latest version of Python.
python --version
This will print python version on screen.
Python 3.9.0
Click here to further learn about python virtual environment management.
Git
Run following command to install git on MacOS using homebrew.
brew install git
CMake
CMake is simply a crossplatform make tool, run following command to install it on your mac.
brew install cmake
Ninja Build
Ninja build tool is used with gyp or CMake and it makes the build process a lot faster.
brew install ninja
Summary of the ESP IDF Prerequisites
Here is the summary of all dependencies for all major platforms.
- Windows
- MacOS
- Linux
Setup Visual Studio Code for ESP IDF development
Download and install Microsoft Visual Studio Code if you do not have installed.
Open visual studio code and search for “ESP-IDF” from extensions side bar panel.

Choose the “Espressif IDF” extension from Espressif Systems and click on “Install” button.

Configure ESP IDF Extension
Open visual studio code command palette by pressing F1 key or “Cmd + Shift + P” on MacOS or “Control + Shift + P” on Windows OS. Type “ESP-IDF: Configure ESP-IDF extension” in command palette and hit Enter.

Above command will open thee extension setup page, from this page click on “EXPRESS” to start the setup process. There is also another called “ADVANCED” setup on the same page, choose this for manual setup of ESP IDF tools or if you already have ESP IDF framework and tools installed on your system, otherwise if you are doing this on a fresh system or for the first time then “EXPRESS” is the most appropriate option for you.

Next the ESP extension setup wizard will move you to the tool and path selection page, from this page choose following options.
Option | Value to choose | Description |
Download Server | GitHub | Choose the source of ESP-IDF build tools, GitHub or Espressif. |
ESP-IDF Version | v4.2 (release version) | Choose the latest available version, this was the latest version at time of writing this article. |
ESP-IDF Container Directory | $HOME/esp | The destination of ESP IDF tools. |
Python Version | Python 3.5+ | Python version |

Click on the install button to start the install the required tools for ESP IDF build.

You are ready to build applications once the installation process is complete.
Useful ESP IDF Visual Studio Code Commands
On Microsoft Windows OS replace “⌘ (Cmd)” with “Ctrl” key.
Action | Description | Keyboard Shortcut |
Create new ESP IDF project | Creates blank ESP IDF project | ⌘ E N |
Create new ESP project based on one from available list of templates. | ⌘ E C | |
Select port to use | Choose the COM port where you have connected the ESP32 module. | ⌘ E P |
Build your project | Compile / build current project | ⌘ E B |
Flash your project | Flash current project onto the ESP32 chip connected via selected COM port. (build before flashing on chip) | ⌘ E F |
Monitor your device | Monitor the running program on ESP32 chip connected with the selected COM port. | ⌘ E M |
Build, Flash and start a monitor on your device | This command will build, flash and start a monitor in sequence. | ⌘ E D |
Full clean project | Full clean will simply delete previously compiled artifacts (not the source code). | ⌘ E X |
SDK Configuration editor | This command will open the SDK configuration editor. | ⌘ E G |
Size analysis of the binaries | This will open up a detailed analysis of generated binary file for current project. Look at the following image for a sample analysis page. | ⌘ E S |
Search in documentation… | Select text from code and press “⌘ E Q” to search it in ESP IDF reference documentation. | ⌘ E Q |
Open ESP-IDF Terminal | This will open a ESP-IDF terminal with all paths set. | ⌘ E T |

USB to UART Bridge VCP Drivers
USB to UART Bridge is used to connect devices with UART interface via USB port of system, you may need to install following drivers to connect ESP32 DevKit (with USB interface) with your PC or MacBook.
Download USB to UART Bridge VCP Drivers.
ESP32 DevKit Connectivity Issue
If you face trouble while flashing your project to an ESP32 module, press and hold the boot button on ESP32 DevKit module and then issue the flash command from visual studio code, this will start the flash process, please note that you can release the boot button once the flash process has started.

In next article we will create a hello world world project using ESP-IDF extension for Visual studio code and will flash it on ESP32 chip.