It’s a time-honored hack: editing the hosts file on your computer to block websites, create local re-directs, and otherwise change what happens when you type particular domains into you address bar.
We’ve shown you how to edit your hosts file using the Terminal on your Mac. While that method’s not hard, it’s a little out of the way if you just want to occasionally block Reddit and Facebook, or experiment with re-directing a few domains to your own local servers.
Happily, there’s Hosts Preference Pane, a tiny application that lets you edit the Hosts file from the macOS System Preferences. To get started, head to the Hosts.prefpane download page and grab the latest version. The download comes in the form of a PKG installer.
Open the installer and go through the steps.
When that’s done, open System Preferences and you’ll see a new “Hosts” icon in the bottom row.
Click this and you’ll be brought to your brand new Hosts preference pane.
Editing the hosts file requires administrator permissions, so to get started you’ll need to click the lock at bottom-left. You’ll be asked for your fingerprint, if you have Touch ID. Otherwise you’ll be asked for your password.
Note that only administrator accounts can change the hosts file: if you’re not an administrator, this isn’t going to work.
Once everything is unlocked, you can add and remove domains to your liking by using the “+” and “-” buttons at bottom left. If you’ve edited a hosts file before, you know the drill: use “127.0.0.1” as the IP, then add the domains you’d like to block.
The “use” column, meanwhile, allows you to quickly remove a line from the hosts file without losing track of it. Anything unchecked in the Hosts Preference Pane won’t show up in the actual hosts file, allowing you to quickly remove and re-add domains you need to occasionally use.
Any change you make here is instantly made to the hosts file—you can confirm this by heading to /private/etc/ on your computer and opening the hosts file. For our purposes, however, the best check is to open your browser and head to a domain you’ve re-directed.
If everything is working you should see the change immediately, though sometimes restarting the browser is necessary. Enjoy your new hosts file!