Block Internet Connection through cocoa

Posted on


In unix (ubuntu) we have iptables command, using which we can block Internet connection for one user. I want to know if there is any cocoa, carbon API using which a user can block his Internet connection for some time and later can re-connect it.

Note: I don’t have administrative privileges.


Mac OS X 10.7 and later supports PF, an OpenBSD packet filter, which is almost certainly the right way to go about this.

The command-line interface to manage rules is pfctl. Likely you’ll need to invoke it as root, using Authorization Services. Here’s an answer which describes an NSTask-like wrapper which may help you.

PF does appear to support rules based on UIDs (look for the user parameter on the man page). If you need help configuring PF to do what you want, post at or

Leave a Reply

Your email address will not be published. Required fields are marked *