Page 1 of 1

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

macOS - Aruino IDE ...
Clear all

[Solved] macOS - Aruino IDE - How to fix "pyserial or esptool directories not found next to this tool" error (ESP8266)

2 Posts
2 Users
Famed Member Admin
Joined: 11 years ago
Posts: 2641
Topic starter  

When switching to Big Sur, somehow the ESP8266 tools for the Arduino IDE broke ... and one cannot upload compiled sketches any more.

An example of this error:

pyserial or esptool directories not found next to this tool.
An error occurred while uploading the sketch


This affects at least ESP8266 Core version 2.7.4 and 2.7.2 (I'm running Arduino IDE version: 1.8.13 right now).

The fix:

  1. Open the file
  2. Comment out lines 29 and 30 and add these lines:
       iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
       cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')

The code should look something like this, save it and try again ... this fixed it on my Mac:

from import list_ports_common

#iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
#cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))
iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')

kIOMasterPortDefault = ctypes.c_void_p.in_dll(iokit, "kIOMasterPortDefault")
kCFAllocatorDefault = ctypes.c_void_p.in_dll(cf, "kCFAllocatorDefault")

Joined: 1 second ago
Posts: 0

Very useful,

It worked for me (iMAC BIG SUR).

thanks for sharing

Hans reacted

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).