From NFC Tools
(Difference between revisions)
Jump to: navigation, search
(Manual installation: Fix nfc-list path when not installed and add nfc-scan-device as first command)
Line 166: Line 166:
== Windows ==
== Windows ==
See [[Libnfc:Windows]]

Revision as of 20:51, 17 September 2013

Public platform independent Near Field Communication (NFC) library

libnfc is the first libre low level NFC SDK and Programmers API released under the GNU Lesser General Public License.
It provides complete transparency and royalty-free use for everyone.
This list shows the current supported features.
All major operating systems are supported, including GNU/Linux, Mac OS X and Windows. Compilation should work out of the box on POSIX-systems.
This library supports various NFC hardware devices: dongles, flat and OEM devices.
The library currently supports modulations for ISO/IEC 14443 A and B, FeliCa, Jewel/Topaz tags and Data Exchange Protocol (P2P) as target and as initiator.



Stable release

Stable releases can be found at libnfc download section.

Development version

Fetch current version using Git as described in this page:

git clone

Note: If you want all libnfc hardware drivers, you will need to have libusb (library and headers) plus on *BSD and GNU/Linux systems, libpcsclite (library and headers).

Under MacOSX, GNU/Linux, *BSD and probably a lot of POSIX systems you can compile development version using:

autoreconf -vis
./configure --enable-doc
sudo make install

If you want to (re)generate documentation:

make doc

Third party packages


The following sections describe per platform how to install and use libnfc.
Because some dependencies (e.g. libusb,PCSC-Lite) are used, the requirements per platform can differ.

POSIX systems

Manual installation

First make sure you have required compilation dependencies, ie. you will need headers from:

  • libusb
  • pcsc-lite

Download and extract libnfc archive

$ wget
$ tar -xvzf libnfc-x.x.x.tar.gz

Configure and compile

$ cd libnfc-x.x.x
$ ./configure --prefix=/usr --sysconfdir=/etc
$ make

Please note that ./configure have an installation path prefix set as /usr/local and sysconfdir set as $PREFIX/etc as default. Use --prefix and sysconfdir option, if you want another setup (see ./configure --help).

Make sure you have required run-time dependencies.

  • libusb
  • pcsc-lite (with pcscd), libccid

Plug in NFC device, and test if libnfc detect it

$ libnfc/utils/nfc-scan-device -v

Place a tag on it and show it

$ libnfc/utils/nfc-list

Install libnfc into your system

$ sudo make install

Debian / Ubuntu

First make sure you have required compilation dependencies.

 $ sudo apt-get install libusb-dev libpcsclite-dev

Download and extract libnfc archive

$ wget
$ tar -xvzf libnfc-x.x.x.tar.gz

Build Debian package

$ cd libnfc-x.x.x
$ svn checkout
$ dpkg-buildpackage -b -us -uc

Make sure you have required run-time dependencies.

$ sudo apt-get install libusb-0.1-4 libpcsclite1 libccid pcscd

Install libnfc into your system

$ sudo dpkg -i ../libnfc*.deb

Plug in NFC device, place a tag on it and test your installation

$ nfc-list


Romain Tartière contributed a FreeBSD port of libnfc, thanks to him.

  • To install the port:
 cd /usr/ports/devel/libnfc/ && make install clean
  • To add the package:
 pkg_add -r libnfc


Thanks to Mike Auty, libnfc have a ebuild to be easily installed on Gentoo using usual way:

 $ emerge libnfc

Fedora 12+

Thanks to François Kooman, libnfc library is now included in Fedora 12+ distribution.

Using command line interface

 # yum install libnfc libnfc-devel libnfc-examples
  • libnfc-devel contains development headers and libraries, its only necessary if you want to

compile your own applications requiring libnfc

  • libnfc-examples contains the example tools like nfc-list.

Using graphical tools

  • System -> Administration -> Add/Remove Software
  • Search for libnfc and select the appropriate packages for installation.

Mac OS X

For installing dependencies, MacPorts download manager is used (available at:

Install MacPorts following instructions from

Install pkg-config:

 $ sudo port install pkgconfig

Install glib:

 $ sudo port install glib

Install glib:

 $ sudo port install libusb

Make sure it's the x86_64 version (when on the latest OS X):

 $ lipo -info /usr/local/lib/libusb.dylib

As the libnfc's MacPort is not up-to-date, now follow Manual installation instructions to compile libnfc using usual autotools way.

Warning: We have previously posted a link to darwinports .com, according to MacPorts project: they are an impostor / phishing site designed to get donations from unsuspecting users. Donations made to that site do not benefit MacPorts project and the instructions shown there for installing software are incorrect. To know more about this issue:

Official MacPorts' site: If you are looking for how to use and install MacPorts, please visit:


See Libnfc:Windows


See Libnfc:quick start example how to create code using libnfc.

For a list of projects using this library, see Related links.

A few of them have their page on this wiki, check Software category


Having trouble? Check the FAQs and consult the Troubleshooting page.


ChangeLog is directly available from libnfc's repository:

If you want more detailed change log, you can use the repository log:


There are many ways to contribute to libnfc, including but not limited to:


You can also sponsor us with hardware donations, to do so please contact

If you are manufacturer and you want your device to be supported in libnfc, feel free to send a mail to

Thanks to manufacturers which already done it, see sponsor page.

Personal tools