Q&A: Blocking popups in OS X

Q Further to my desire to block popups in my browser, I have seen a solution in Apple Support discussions that uses an AppleScript to modify the ‘hosts’ file to block the addresses. Is that effective?

A That solution saves you from adding manually several well-known popup advertising servers to the network ‘hosts’ configuration, by running a short AppleScript to send the commands to the command shell. Yes it does work, but Apple deprecates modifications to the ‘hosts’ file, as there are smarter ways to do that using firewalls, and one day the file may be ignored. Popup servers also get wise to the block, and may use different servers to circumvent your block, forcing you to play cat and mouse.

There are some ad blockers already available, and if you can wait just a little for the release of El Capitan (OS X 10.11), it will bring Safari version 9 which has built-in support for content blocking plug-ins. That should make blocking easier and cheaper, although the long-term consequences remain controversial.

Updated from the original, which was first published in MacUser volume 30 issue 8, 2014.