Serial Error [OSError: [Errno 16] Resource busy: '/dev/cu.usbserial-0001'

I get a compile error in IDE 2.3.2 but success (prints output in Serial Monitor) in IDE 1.8.19 same ESP8266 board and code and PC.
My OS is 12.7.3 on Mac mini 2018

Compile error message
Using library IRremoteESP8266 at version 2.8.6 in folder: /Users/mack/Documents/Arduino/libraries/IRremoteESP8266
/Users/mack/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-size -A /private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/5269398BAC8E23CAECACA3C873EFC728/TurnOnMitsubishiAC.ino.elf
Sketch uses 273265 bytes (28%) of program storage space. Maximum is 958448 bytes.
Global variables use 28276 bytes (34%) of dynamic memory, leaving 53644 bytes for local variables. Maximum is 81920 bytes.
"/Users/mack/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3" -I "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py" --chip esp8266 --port "/dev/cu.usbserial-0001" --baud "115200" "" --before default_reset --after hard_reset write_flash 0x0 "/private/var/folders/5v/dc3kh_4136g2j560dgjg3vww0000gn/T/arduino/sketches/5269398BAC8E23CAECACA3C873EFC728/TurnOnMitsubishiAC.ino.bin"
esptool.py v3.0
Serial port /dev/cu.usbserial-0001
Traceback (most recent call last):
File "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/pyserial/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Resource busy: '/dev/cu.usbserial-0001'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py", line 66, in
esptool.main(cmdline)
File "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 3551, in main
esp = chip_class(each_port, initial_baud, args.trace)
File "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 271, in init
self._port = serial.serial_for_url(port)
File "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/pyserial/serial/init.py", line 90, in serial_for_url
instance.open()
File "/Users/mack/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/pyserial/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.usbserial-0001: [Errno 16] Resource busy: '/dev/cu.usbserial-0001'
Failed uploading: uploading error: exit status 1

Hi @mackarduino. Hi @klausn. There is a known bug in Arduino IDE 2.x that can cause uploads to fail with this "Access is denied" error if you try uploading to boards using certain USB to serial bridge chips while the Arduino IDE Serial Monitor or Serial Plotter is open.

A port can only be used by one process at a time, so Arduino IDE must automatically close the port in Serial Monitor and Serial Plotter during an upload, automatically opening it again after. For some reason, that juggling of the port control is not working with certain chips.

If that bug is the cause of the problem you are having, the workaround will be to manually close the port in Serial Monitor/Serial Plotter before doing an upload. Please give that a try and then let me know if you still have the error while uploading:

Serial Monitor

  1. Click the X icon on the "Serial Monitor" tab in the bottom panel of the Arduino IDE window to close the tab:
    image
  2. Upload the sketch.
  3. Open Serial Monitor again if needed (by clicking the icon on the IDE toolbar or the Tools > Serial Monitor menu item) after the upload is finished.

Serial Plotter

If you have the "Serial Plotter" window open, the procedure is a bit different from closing the Serial Monitor connection:

  1. Close the "Serial Plotter" window.
  2. If the "Serial Monitor" view is not already open, select Tools > Serial Monitor from the Arduino IDE menus to open it.
    We must do an open/close cycle on Serial Monitor as a workaround for a bug in Serial Plotter
  3. Click the X icon on the "Serial Monitor" tab in the bottom panel of the Arduino IDE window to close the tab:
    image
  4. Upload the sketch.
  5. Open Serial Monitor and/or Serial Plotter again if needed after the upload is finished.

Please let me know if you have any questions or problems while following those instructions.

Hi

I changed the Board from Generic ESP8266 to NodeMCU 1.0(ESP-12E Module) and with Serial Monitor off get success with IDE 2.3.2 on Mac os 12.7.3

But no success with Mac os13.6.4

Hi,
Ignore my ¡°But no success with Mac os13.6.4¡±
Not yet properly tested.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.