Installation Instructions
The page describes 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: you will need headers of:
- libusb
- pcsc-lite
Download and extract libnfc archive
$ wget http://libnfc.googlecode.com/files/libnfc-x.x.x.tar.gz $ tar -xvzf libnfc-x.x.x.tar.gz
Configure and compile
$ cd libnfc-x.x.x $ ./configure $ make
Make sure you have required run-time dependencies.
- libusb
- pcsc-lite (with pcscd), libccid
Plug in NFC device, place a tag on it and test your compilation
$ src/nfc-list
Install libnfc into your system
$ make install
Note: ./configure have an installation path prefix set as /usr/local as default. Use –prefix option, if you want another setup (see ./configure –help).
Debian / Ubuntu
First make sure you have required compilation dependencies.
$ sudo apt-get install libusb-dev libpcsclite-dev
Download and extract libnfc archive
$ wget http://libnfc.googlecode.com/files/libnfc-x.x.x.tar.gz $ tar -xvzf libnfc-x.x.x.tar.gz
Build Debian package
$ cd libnfc-x.x.x $ svn checkout http://libnfc.googlecode.com/svn/tags/libnfc-x.x.x/debian $ dpkg-buildpackage -rfakeroot
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
FreeBSD
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
Gentoo
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
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: http://trac.macports.org/wiki/DarwinPorts
Official MacPorts' site: http://www.macports.org/ If you are looking for how to use and install MacPorts, please visit: http://guide.macports.org/
For installing dependencies, MacPorts download manager is used (available at: http://distfiles.macports.org/MacPorts/)
Theses instructions are outdated, Mac OS X users should compile libnfc using usual autotools way (similar to actual Manual installation instructions).
Update and install dependencies
$sudo port -v selfupdate $sudo port install libusb
Download and extract the libnfc library
$wget http://libnfc.googlecode.com/files/libnfc-x.x.x.tar.gz $tar -xvzf libnfc-x.x.x.tar.gz
Compile
$cd libnfc-x.x.x/macosx $make
Plug in NFC device, place a tag on it and test your compilation
$./nfc-list
Windows
- Get the source files
- Download the Source for Microsoft Windows (libnfc-1.3.3-winsdk.zip)
- Extract the files to your computer (e.g. C:\libnfc-1.3.3-winsdk)
- MinGW
- Download MinGW from http://www.mingw.org/
- Install MinGW Make
- Make sure to add the MinGW\bin to the Windows PATH Environment Variable
- Windows SDK
- Download Microsoft Windows SDK v7.0 (http://msdn.microsoft.com/en-us/windows/bb980924.aspx)
- Open the Start Menu\All programs\Microsoft Windows SDK v7.0\CMD Shell
C:\Program Files\Microsoft SDKs\Windows\v7.0> WindowsSdkVer.exe -version:v7.0 C:\Program Files\Microsoft SDKs\Windows\v7.0> cd C:\libnfc-1.3.3-winsdk\win32 C:\libnfc-1.3.3-winsdk\win32>mingw32-make