KoblentsBlog Photography
Contact About
Unloading FTDI drivers on a Mac for libftdi
Installing libftdi on a mac is easy these days.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install libusb
$ brew install libftdi
But then you write a program using libftdi, and surprise surprise, it won't let your program open the FTDI device. Something like:
FTDI USB open error: unable to claim usb device. Make sure the default FTDI driver is not in use (-t)
So we can check which FTDI kernel extensions are loaded using
kextstat | grep -i ftdi
, and if there are any, on a modern system, it'll be AppleUSBFTDI. It can be unloaded easily:
sudo kextunload -bundle-id com.apple.driver.AppleUSBFTDI

And if you're lucky, you can now run your programs against libftdi with no issue. When you're done, kextload replacing kextunload in the command above re-loads the driver.
However, you may face a seemingly impossible problem: you unload the kext, you try to run your program, and you get the same exact error. Unplugging and replugging the device doesn't help. It clearly enumerates - it's visible when you do
system_profiler SPUSBDataType
- yet you can't take it!
If this happens, try running
kextstat | grep -i ftdi
again; you'll likely see that the legacy FTDI driver - com.FTDI.driver.FTDIUSBSerialDriver - is now present! Once you unload this too, re-run your code, and it should be able to talk to the FTDI device.
Ches Koblents
November 4, 2015
« Newer Older »
© Copyright Koblents.com, 2012-2017