Scapy on Mac OS X 10.11 and beyond

Scapy is a Python library that does low-level packet manipulation. It’s also useful in playing with Amazon Dash Buttons. There are plenty of older instructions on getting it running on Mac OS X, but many of these don’t work on Mac OS X 10.11/10.12 where System Integrity Protection (SIP) is enabled by default. Here’s a script to do it for you:


echo "We need root permissions to install libdnet"
sudo echo "OK"
curl -O ""
python --user
$PIP_BIN install scapy --user
$PIP_BIN install pypcap --user
curl -L -o
cd libdnet-libdnet-1.12
sudo make install
cd python
python install --user

A few notes:

  • You will need the Command Line Tools package to compile libdnet. If you don’t have them installed already, you should be automagically prompted by the OS.
  • We use the --user flag to install locally in our home directory, avoiding problems with SIP (which protects system files, including parts of the shared Python directories)
  • We use pypcap rather than pcapy, because the latter does not work
  • The latest version of libdnet is 1.12 (contrary to the SourceForge page, which indicates that the latest is 1.11), and can be found on GitHub
This entry was posted in Pub. Bookmark the permalink.

8 Responses to Scapy on Mac OS X 10.11 and beyond

  1. My man!
    Thanks for this! I had followed a lot instructions to install scapy but none of them worked.

    Really helpful

  2. lid says:

    I’m glad it was useful for you!

  3. Gonzague says:

    Super useful thanks!

  4. Vas says:

    Hi, which version of Python will I need, to install scapy ?

  5. Mario says:

    the only guide that really worked. Thank u!

  6. lid says:

    @Vas The default OS install is fine (currently Python 2.7.10).
    @Mario I’m glad it was helpful!

  7. Chuck Benson says:

    This is great & worked. Thanks

  8. pratik p. says:

    Thanks to your help I was able to get this working.

Leave a Reply

Your email address will not be published.