DFU not working in Arduino IDE (MacOS)

When I try to flash firmware using DFU from the latest Arduino IDE, I’m encountering the following error:

```
sh “/Users/rozzie/Library/Arduino15/packages/STMicroelectronics/tools/STM32Tools/2.4.0/stm32CubeProg.sh” -i dfu -f “/Users/rozzie/Library/Caches/arduino/sketches/EE382C7E844F687B7316224527814660/host.ino.bin” -o 0x0 -v 0x0483 -p 0xdf11 -a 0x8000000 -s 0x8000000
getopt: illegal option – a
Warning: long options not supported due to getopt from BSD usage.
Terminating…
Failed uploading: uploading error: exit status 1
```

This used to work, what gives?

This is a known issue in the Arduino Tools repository:

TL;DR: The problem is stemming from the BSD version of getopt. A simple workaround is to install GNU getopt.

This can be accomplished using:

brew install gnu-getopt
1 Like