Installing libnfc with Brew on Mountain Lion

28 August 2012

Building libnfc on Mountain Lion using Brew takes a few extra steps that aren't documented anywhere. It took me a while to get everything working but once it did, I libnfc worked without any problems.


The initial setup is straight forward. Here I'm using r1469 but these instructions should also allow for building against the latest in version control.

svn checkout libnfc-read-only
cd libnfc-read-only


If you haven't updated brew in a little while, it's best to update it.

brew update

The pn53x_usb requires libusb 0.1 to be installed, if you install libusb 1.0 the configure and complication will fail. Using homebrew you can install libusb 0.1 with the command below.

brew install libusb-compat

You need to install a couple support packages to properly compile.

brew install pkg-config
brew install automake   
brew install glib
brew install libtool


autoreconf -Wall -vis

I'm using a SCL3711 NFC Reader which uses the pn53x_usb driver. Depending on the reader you're using, a different driver will be required. To check which driver you require, you can reference this support matrix.

./configure --with-drivers=all --enable-serial-autoprobe

On Lion/Mountain Lion if see the following, libusb 0.1 wasn't installed properly. Go back an ensure libusb was correctly installed.

checking for libusb... no
checking for libusb... no
checking for libusb-config... no
checking usb.h usability... no
checking usb.h presence... no
checking for usb.h... no
configure: error: The libusb headers are missing


make clean
sudo make
sudo make install
comments powered by Disqus