Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fixing broken ngrep with OS X Mavericks

Migrating to OS X Mavericks breaks the ngrep utility. Doing:

sudo ngrep -d lo0 -q -W byline port 8080

stopped working where the process exits immediately. I didn't dig into the ngrep code, but was able to find a simple workaround by doing

sudo ngrep -q -W byline -d lo0 '' 'port 8080'

You can call that a lazy hack, but it work!

@dch

This comment has been minimized.

Copy link

commented May 28, 2014

nice idea, this works for me without needing to remember quirky syntax. I have no idea how you discovered this workaround!

commit 628d35c4be805bc89de30b14128c5a88e41d76eb
Author: Dave Cottlehuber <dch@skunkwerks.at>
Date:   Wed May 21 15:27:25 2014 +0200

    ngrep: workaround for upstream bug

diff --git a/Library/Formula/ngrep.rb b/Library/Formula/ngrep.rb
index c82939c..9809799 100644
--- a/Library/Formula/ngrep.rb
+++ b/Library/Formula/ngrep.rb
@@ -18,7 +18,10 @@ class Ngrep < Formula
                           "--enable-ipv6",
                           "--prefix=#{prefix}",
                           # this line required to make configure succeed
-                          "--with-pcap-includes=/usr/include"
+                          "--with-pcap-includes=/usr/include",
+                          # this line required to avoid segfault
+                          # https://github.com/Homebrew/homebrew/issues/27171
+                          "--disable-pcap-restart"
     system "make install"
   end
 end

@jpr5

This comment has been minimized.

Copy link

commented Jun 12, 2014

This was submitted as an issue, and I just followed up with an explanation.

If you have any other problems in the future, please don't hesitate to CC me in.

cheers,
--jordan

@jpr5

This comment has been minimized.

Copy link

commented Jun 12, 2014

I think I've got this fixed on https://github.com/jpr5/ngrep/tree/true-up

I'd appreciate it if you could give it a whirl and let me know either way. Thanks!

@falcn

This comment has been minimized.

Copy link

commented Jun 16, 2014

jpr5 - yes, it is working now, thank you (OS X 10.9.3)

@geraldstanje

This comment has been minimized.

Copy link

commented May 29, 2018

any idea why that is not working?

$ sudo ngrep -t "/getResponseRate" -d lo0 port 8081 -q -W byline
interface: en0 (172.11.83.0/255.255.252.0)
pcap compile: syntax error

$ ifconfig lo0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
	nd6 options=1<PERFORMNUD>
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.