Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Scapy on OSX through Homebrew
require 'formula'
class LibdnetPython <Formula
depends_on 'libdnet'
url 'http://libdnet.googlecode.com/files/libdnet-1.12.tgz'
homepage 'http://code.google.com/p/libdnet/'
sha1 '71302be302e84fc19b559e811951b5d600d976f8'
def install
ENV["CFLAGS"] = "-O3 -w -pipe"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}"
system "make"
system "cd python && /usr/local/bin/python setup.py install"
end
end
require 'formula'
class Pylibpcap <Formula
url 'http://downloads.sourceforge.net/project/pylibpcap/pylibpcap/0.6.4/pylibpcap-0.6.4.tar.gz'
homepage 'http://pylibpcap.sourceforge.net/'
sha1 '30b5d2e9dc8dcf6df067a216d9ecae109ff34f86'
def install
system "/usr/local/bin/python setup.py install"
end
end
require 'formula'
class Scapy <Formula
depends_on 'libdnet_python'
depends_on 'pylibpcap'
url 'http://www.secdev.org/projects/scapy/files/scapy-2.1.0.tar.gz'
homepage 'http://www.secdev.org/projects/scapy/'
sha1 'e507bc0f2a32d209f321580c9338d2ceb72ab93a'
def install
system "/usr/local/bin/python setup.py install"
end
end
@benhagen

This comment has been minimized.

Copy link
Owner Author

commented Mar 27, 2013

Homebrew formula goes in:
/usr/local/Library/Formula

@ghost

This comment has been minimized.

Copy link

commented Aug 9, 2013

I'm getting an error when I try to run the scapy install:

$ brew install scapy
==> Downloading http://www.secdev.org/projects/scapy/files/scapy-2.1.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/scapy-2.1.0.tar.gz
==> /usr/local/bin/python setup.py install
Error: Empty installation

EDIT: Resolution here https://github.com/samueljohn/homebrew-python/blob/master/scapy.rb

@mdearlove

This comment has been minimized.

Copy link

commented Dec 23, 2013

Works a treat on OS X Mavericks - thanks :-)

@xoration

This comment has been minimized.

Copy link

commented Dec 30, 2013

Installing scapy works fine - without error - but after install I get:
Traceback (most recent call last):
File "/usr/local/bin/scapy", line 23, in
from scapy.main import interact
ImportError: No module named scapy.main

OS X Mavericks here - Not sure if it's related to the formula somehow?

@JGJones

This comment has been minimized.

Copy link

commented Jan 29, 2014

I have the same issue as xoration above. (also on OSX 10.9)

@vivekagr

This comment has been minimized.

Copy link

commented Mar 27, 2014

Facing the same issue as xoration on Mavericks. Has anybody figured out the solution?

@flankerhqd

This comment has been minimized.

Copy link

commented Apr 3, 2014

I think one should add scapy's path to PYTHONPATH to avoid ImportError, also the scapy homepage is down now (503 unavailable) at 2014.4.3 23:00 GMT+8

@bsterne

This comment has been minimized.

Copy link

commented May 29, 2015

I had the same errors as xoration and vivekagr, but that was before I looked at the output of brew install scapy, which at the end gave me:

==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
  mkdir -p /Users/bsterne/Library/Python/2.7/lib/python/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/bsterne/Library/Python/2.7/lib/python/site-packages/homebrew.pth

Running those two commands resolved the issue for me. Make sure you account for your own home directory and system Python site-packages directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.