Installing the ESP32 Board in Arduino IDE (Mac OS X and Linux instructions)

There’s an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. In this tutorial we’ll show you how to install the ESP32 board in the Arduino IDE on Mac OS X or Linux. If you’re using a Windows PC follow these instructions instead. 

Watch the Video Tutorial

This tutorial is available in video format (watch below) and in written format (continue reading this page). 

If you have any problems during the installation procedure, take a look at the ESP32 troubleshooting guide.

If you like the ESP32, enroll in our brand new course: Learn ESP32 with Arduino IDE.

Installing the ESP32 Add-on on Arduino IDE

Important: before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work. Having the latest Arduino IDE software installed from arduino.cc/en/Main/Software, continue with this tutorial.

IMPORTANT NOTE:

  1. If this is your first time installing the ESP32 on the Arduino IDE, simply follow the installation procedure described below;
  2. If you’ve already installed the ESP32 add-on using the old method, you should remove the espressif folder first. Go to the end of this post to learn how to remove the espressif folder.

1. Installing the ESP32 Board

To install the ESP32 board in your Arduino IDE, follow these next instructions:

1) Open the preferences window from the Arduino IDE. Go to Arduino > Preferences

2) Enter https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button:

Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

3) Open boards manager. Go to Tools > Board > Boards Manager…

4) Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

5) That’s it. It should be installed after a few seconds:

Testing the Installation

Plug the ESP32 board to your computer. Then, follow these steps:

1) Open the Arduino IDE

2) Select your Board in Tools > Board menu (in my case it’s the DOIT ESP32 DEVKIT V1)

3) Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to install the ESP32 CP210x USB to UART Bridge VCP Drivers):

4) Open the following example under File > Examples > WiFi (ESP32) > WiFi Scan

5) A new sketch opens:

6) Press the Upload button in the Arduino IDE. Wait a few seconds while the code compiles and uploads to your board.

7) If everything went as expected, you should see a “Done uploading.” message.

8) Open the Arduino IDE Serial Monitor at a baud rate of 115200:

9) Press the ESP32 on-board Enable button and you should see the networks available near your ESP32:

This is a very basic tutorial that illustrates how to prepare your Arduino IDE for the ESP32 on your computer.

2. Deleting the espressif folder

If this is your first time installing the ESP32 on Arduino IDE you can ignore this section.

If you’ve followed the older installation procedure and you’ve manually installed the ESP32 add-on with Git GUI, you need to remove the espressif folder from your Arduino IDE.

To find your espressif folder and Arduino IDE location (installation path), open your Arduino IDE and go to Arduino > Preferences:

Copy the location from the “Sketchbook location” field:

Go to your Arduino IDE location directory: /Users/Rui/Documents/Arduino, open the hardware folder, and delete the espressif folder.

Wrapping Up

This is a very basic tutorial that illustrates how to prepare your Arduino IDE for the ESP32 on a Mac or a Linux PC. We took those screenshots using Mac OS X, but a very similar procedure is done for Linux.

You might also like reading:

Do you have any questions? Leave a comment below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

P.S. Learn how to install the ESP32 Board in Arduino IDE (Windows instructions)

P.P.S. Getting Started with ESP32 Dev Module



Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!

What to Read Next…


Enjoyed this project? Stay updated by subscribing our newsletter!

29 thoughts on “Installing the ESP32 Board in Arduino IDE (Mac OS X and Linux instructions)”

  1. I followed your first steps on using ESP32 and the compilation failed with the message:
    Arduino: 1.8.5 (Linux), Board: “DOIT ESP32 DEVKIT V1, 80MHz, 921600, None”
    Archiving built core (caching) in: /tmp/arduino_cache_543039/core/core_esp32_esp32_esp32doit-devkit-v1_FlashFreq_80,UploadSpeed_921600,DebugLevel_none_cad725f6ad98297b5930f65b34ce8c67.a
    Traceback (most recent call last):
    File “/home/mariano/.arduino15/packages/esp32/tools/esptool/2.3.1/esptool.py”, line 34, in
    import serial
    ImportError: No module named serial
    Multiple libraries were found for “WiFi.h”
    Used: /home/mariano/.arduino15/packages/esp32/hardware/esp32/1.0.0/libraries/WiFi
    Not used: /home/mariano/arduino-1.8.5/libraries/WiFi
    exit status 1
    Error compiling for board DOIT ESP32 DEVKIT V1.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Can you help me on how to sort this out?

    Reply
    • Hi Mariano.
      Seems that you have two errors going on.
      First, remove the old installation and everything related with the ESP32 from the arduino folders.
      We also recommend uninstalling Arduino and re-installing with the latest version.
      Then, make sure you follow this troubleshooting guide – 5. Error compiling WiFiScan sketch : https://randomnerdtutorials.com/esp32-troubleshooting-guide/

      The WiFi error means that you have multiple libraries installed. Remove the Arduino WiFi library and do the procedure and shown in the previous link.
      I hope this helps,
      Regards,
      Sara 🙂

      Reply
    • Many thanks Alexandre, I was getting the same error. All it required was a ‘pip install pyserial’ on the command line (it needs the Python2 pip not pip3).

      Reply
  2. Got mine working after errors: lua: cannot open init.lua , on my Ubuntu 18.04.1 (64 bit) OS, on Arduino 1.8.8 (64) IDE, fixed by installing the following in terminal.. apt install python-pip
    followed by: pip install esptool
    then: pip install pyserial
    whatever that is.. mine started working on WiFi Scan
    Hope it help you, Love, Kevin

    Reply
  3. It is absolutely okay for esp wroom 32 chip based a board called “LOLIN 32 v 1.0.0”. Although it doesn’t have enable button on board but with reset pin but the “wifi-scan.ino” works flawlessly.

    But in case of esp wrover 32 based breadboard friendly development board having ch340 driver, I could’t help uploading any sketch on it, although it shows the port :”/dev/ttyUSB0″ while connecting board to computer.

    Please help me so that I can upload programs to that ESP WROVER 32 (bread board friendly) development board as soon as possible….
    with regards Subhojit

    Reply
    • Hi.
      I think it may be an issue regarding CH340 drivers and MACOS.
      Can you please read the following article and see if it helps: thingsmatic.com/2017/08/07/using-ch340-devices-with-osx/
      Regards,
      Sara

      Reply
  4. I am using a MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports with 2.3 GHz Dual-Core Intel Core i5. I struggled a lot as I was not able to see a port for ESP32 in Arduino IDE. Finally, I stumbled upon this youtube video and voila:

    youtube.com/watch?v=wyocdvAKo64

    I hope this helps.

    Reply
  5. I have an issue with my ESP32 (Arduino Uno working perfectly on the same Arduino IDE on Mac).

    Compilation is OK, then I have a communication issue :

    Traceback (most recent call last):
    esptool.py v2.6
    Une erreur est survenue lors du transfert du croquis
    Serial port /dev/cu.usbserial-0001
    File “esptool.py”, line 2959, in
    File “esptool.py”, line 2952, in _main
    File “esptool.py”, line 2652, in main
    File “esptool.py”, line 222, in init
    File “serial/init.py”, line 88, in serial_for_url
    File “serial/serialposix.py”, line 268, in open
    serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.usbserial-0001: [Errno 16] Resource busy: ‘/dev/cu.usbserial-0001’
    Failed to execute script esptool

    Tried many things without success, any idea or help is more than welcome.

    Reply
    • Hi Alex.
      I think that means you don’t have the right COM port selected or that COM port is being used by another program.
      Regards,
      Sara

      Reply
      • Hi Sara,

        Possibly yes, however it is the only port appearing when plugin the ESP32 into the USB (not available/visible when unplugging the ESP32)
        If an other program than the ArduinoIDE is using the port how can we know which one (On MacBookAir) ?

        regards
        Alex

        Reply
  6. Brand new to this experience, so a very noob question that these articles don’t address (though I maybe just missed it). How do I physically connect the esp32 to my computer?

    Reply
    • Hi.
      Most ESP32 development boards have a USB socket. Connect an USB cable from the ESP32 to your computer.
      The USB cable must have data wires (not just power wires) so that you can establish a serial communication and upload code.
      Regards,
      sara

      Reply
  7. Hello,
    I can’t get this to work at all, I’ve tried 3 different Windows 7 computers and receive the same result and it is using the correct port:

    File “PyInstaller\loader\pyimod02_importers.py”, line 352, in exec_module

    File “esptool\bin_image.py”, line 14, in

    File “PyInstaller\loader\pyimod02_importers.py”, line 352, in exec_module

    File “esptool\loader.py”, line 30, in

    File “PyInstaller\loader\pyimod02_importers.py”, line 352, in exec_module

    File “serial__init__.py”, line 29, in

    File “PyInstaller\loader\pyimod02_importers.py”, line 352, in exec_module

    File “serial\serialwin32.py”, line 15, in

    File “PyInstaller\loader\pyimod02_importers.py”, line 352, in exec_module

    File “ctypes__init__.py”, line 7, in

    ImportError: DLL load failed while importing _ctypes: The parameter is incorrect.

    [4648] Failed to execute script ‘esptool’ due to unhandled exception!

    exit status 1
    Error compiling for board AI Thinker ESP32-CAM.

    Reply
  8. Hello Everyone ! Currentlty I am currently facing an issue with Arduino Version 1.8.19 on my Mac Pro M2. When I click on “Get Board Info” under Tools, it gives me an error “Native serial port, can’t obtain info.” In the port section, it shows the port of my Mac, and I can select it. The selected board is ESP32 DEV MODULE, and everything seems fine and intact except when I try to use “Get Board Info.” Consequently, I am unable to launch the program.

    I suspect the issue might be due to the Mac being new and the Arduino version being outdated, and they may not be compatible. I have searched for compatible drivers, but I keep encountering the same problem.
    Any Suggestions /Solutions Thank you

    Reply
  9. I just tried this and had this error…

    Sketch uses 714505 bytes (54%) of program storage space. Maximum is 1310720 bytes.
    Global variables use 43344 bytes (13%) of dynamic memory, leaving 284336 bytes for local variables. Maximum is 327680 bytes.
    esptool.py v4.5.1
    Serial port /dev/ttyUSB0
    Connecting….
    Chip is ESP32-D0WD-V3 (revision v3.1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    Crystal is 40MHz
    MAC: 08:d1:f9:e9:d0:7c
    Uploading stub…
    Running stub…
    Stub running…
    Changing baud rate to 921600
    Changed.

    A fatal error occurred: Unable to verify flash chip connection (Serial data stream stopped: Possible serial noise or corruption.).
    A fatal error occurred: Unable to verify flash chip connection (Serial data stream stopped: Possible serial noise or corruption

    .I’m using the USB Cam M8 as the programmer and I’m running the Arduino IDE on Linux Mint.

    Reply

Leave a Comment

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.