When I try to upload my code onto the Arduino it just gives me the error message: "avrdude: ser_open(): can't open device "/dev/cu.usbmodem14201": No such file or directory Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions."

My Arduino used to function just fine. Now when a plug it in, the lights on the Arduino do not blink like they used to, and the only pins that do anything are the ones to power. It also said something like: Arduino is not optimized for mac os. It seems that the Arduino is taking in the power but not the code. here's the code:

int led = 13; // the pin the LED is connected to
void setup() {
  pinMode(led, OUTPUT); // Declare the LED as an output

void loop() {
  digitalWrite(led, HIGH); // Turn the LED on
  • Is there a power LED? Is that lit? The lights for the serial connection are only going to blink if there is a program on the board that is sending serial data. I would try it on a different computer and see if its the Mac or the arduino causing issues.
    – Chad G
    May 3, 2019 at 18:37
  • Genuine Arduino or cheap Chinese clone?
    – Majenko
    May 3, 2019 at 18:48
  • While having your Arduino connected try pushing the reset button and report us if there is anything blinking. May 3, 2019 at 19:33
  • Make sure you have a USB cable with data lines - I spent a couple of hours trying to debug a similar problem because of a "Charging Only" cable. May 8, 2019 at 16:26

2 Answers 2


I had this issue and it was because the port was not set in my Arduino IDE.

I fixed it by going to Tools -> Port, and selecting my usb device. In my case it was called /dev/cu.SLAB_USBtoUART


I fixed it by plugging it into my other USB port (which I had previously been using)

So possibly this is caused by switching USB ports

  • 2
    Whoever voted this down didn't bother to say why, so I'll take a guess: They probably saw it was short and what looks like a duplicate of an existing answer. You're new here, so sorry for the crappy reception, but I figured I'd at least be able to give you some insight on what the downvote may mean.
    – timemage
    Jun 8, 2022 at 22:59
  • Thanks, I appreciate making you making up for it. I debated putting an answer since its short and not expert insight. But I figured I wish someone put it for me since its super fast to attempt and hints at a possible cause.
    – Jeff Hykin
    Jun 9, 2022 at 23:03
  • This sounds so silly, but honestly was the just the ticket that got me to be able to finally flash via UART to my device. I had this issue both in Arduino IDE as well as VSCode ESP-IDF extension. On a MacBook Pro, ls /dev/cu.* listed /dev/cu.Bluetooth-Incoming-Port /dev/cu.SLAB_USBtoUART /dev/cu.usbserial-XXXX and I set the PORT /dev/cu.SLAB_USBtoUART, flash method to UART, and it didn't work. Unplugging the cable from the top USB near the MacBook screen to the one right below it did work.
    – Michael
    Apr 5, 2023 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.