Has anyone been able to successfully use a pcap library for Ruby 1.9.2 (via rvm) on Mac OS X 10.6?
I have tried pcaprub and it seems to not behave well on Mac OS X and the pcap gem isn’t compatible with ruby 1.9.2.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s definitely some problems building the native extension stuff for the pcap gem on ruby 1.9.2 (I’m on patch 180). Mostly you can get it working by changing RUBYSTR(foo)->ptr to RUBYSTR_PTR(foo) — that’s fairly easy to macro away when you see gcc complaining.
The real problem for me is that it’s blocking after the initial call in pcap_loop. I initially was able to get it to do the right thing, but it doesn’t want to use the correct timeout. If I can get it working right, I’ll definitely be pushing changes upstream.
Edit: see my comments here to get it building on 10.6.
Edit2: I’ve forked ruby-pcap and got it working on ruby 1.9.2 @ patch 180 on Mac OS X 10.6.7; I will be submitting a pull request to the gem shortly. In the meantime, you can get it here