How can I install libpcap header files on Ubuntu 12.04?

When I use apt-get install libpcap I receive following message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libpcap
  • What are you trying to do with libpcap? – Braiam Sep 20 '13 at 17:27
  • 1
    I get source code needs libpcap. It uses libpcap to capture network packets. – SuB Sep 20 '13 at 18:25

Use this:

sudo apt-get install libpcap-dev
  • 2
    That's because 1) libpcap-dev (probably) depends on the libpcap package, and will bring it in and 2) if you have source code that needs libpcap, you not only will need the libpcap package (whatever it's called - its name might be "libpcap0.8", for various Debian reasons), which provides shared libraries for already-built programs that use libpcap, but you will also need the libpcap-dev package, which provides header files needed to compile the source code for programs that use libpcap (and static libraries in case people want them). – user126192 Sep 20 '13 at 18:34

to install libpcap. try these commands

cd /usr
mkdir nembuild
cd nembuild    
wget http://www.tcpdump.org/release/libpcap-1.5.3.tar.gz
tar -xf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3
make && make install


  • Why install a package while there is a binary (RPM, DEB , ...) package for it? Your method is the most complex way dude! – SuB Apr 20 '14 at 4:52
  • 1
    because libpcap 1.5.3 is way better than the version 0.8 available from aptitude – ashgromnies Aug 8 '14 at 16:25
  • 3
    Aptitude does not use 0.8, it is only the name of a package. Check "apt-cache show libpcap-dev" to see the version used. – Étienne Sep 5 '14 at 16:15

To install libpcap open a terminal by pressing Ctrl+Alt+Tand type:

sudo apt-get install libpcap0.8 libpcap0.8-dev libpcap-dev
  • 2
    According to Ubuntu Packages libpcap-dev depends on libpcap0.8-dev and itself depends on libpcap0.8. So libpcap0.8 is redundant. – SuB Sep 20 '13 at 10:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.