1

Editing /etc/hosts works to easily block/unblock sites, but if you already have a browser open, it doesn't work until the browser cache is flushed.

Is there any simple way on OSX to block connections to certain hosts, preferably without 3rd party software? I imagine Little Snitch does what I need behind the scenes, if anyone understands how that works.

2
  • you specify without 3rd party software, but it would be criminal not to mention that Little Snitch does what you want brilliantly! And should be a standard install on every OSX machine connected to the internet!
    – user22908
    May 11, 2013 at 3:43
  • @JarrodRoberson Love little snitch! I'm looking to develop a piece of software that can block sites on it's own, similar functionality, any idea how LS works under the hood?. May 11, 2013 at 4:14

1 Answer 1

2

There are 3 ways to do this on Mac OS X without requiring you to do a lot more.

  1. You have already mentioned the first way - using /etc/hosts.
  2. You have also ruled out using the second way - using browser plugins.
  3. The 3rd way is to use the "Parental Controls" feature under System Preferences.

There is a 4th way - if you are talking about writing code and implementing your own script or your own custom app.

If you are talking about "under the hood" level implementation - i.e. you want to implement a custom application of your own (similar to Little Snitch), then you should get yourself familiar with the concept of iptables (linux systems routinely use this to control access rights to specific hosts and ports).

In Mac OS (which essentially is FreeBSD under the hood), the equivalent is ipfw (IP Firewall) and for Mac OS 10.7 onwards, ipfw has been deprecated in favour of pf (Packet Filter).

Reference article which you can refer to: http://ikawnoclast.com/security/mac-os-x-pf-firewall-avoiding-known-bad-guys/

1
  • Thanks for adding to your answer, that's what I was looking for. May 11, 2013 at 7:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .