Gas Mask: A Simple Hosts File Manager for macOS

Maybe I should start by explaining what a hosts file is. But you can read all about it here. The average user probably shouldn’t mess with the hosts file unless…

ALSO READ HOW TO: Use the Hosts File on Linux to Block Ads, Tracking, Malware Domains and Annoyances

You can use the hosts file to block known malware, advertising or other unwanted domains. In macOS you can find the hosts file in /etc/hosts.

To block a domain all you need to do is to append 0 example.com or 0.0.0.0 example.com or 127.0.0.1 example.com to your hosts file.

Luckily you don’t have to do this manually because there’s a bunch of hosts lists available for everybody to use. See StevenBlack/hostssomeonewhocares.org and l1k/osxparanoia/blob/master/hosts

So how do you manage your macOS’ hosts file? First always backup the original file. You can do that by copying the file to a different location or create a copy in the same location and rename it to hosts.bak ( or something similar that allows you to easily identify it as your backup ).

Then you can create a second copy on your desktop, open the file with TextEdit, edit the file, save it and copy the edited hosts file back to the original location.

Or…

You can use Gas Mask. A simple, free and open source hosts file manager for macOS.

With Gas Mask, you can easily edit your hosts file, create multiple hosts files and switch between them on the fly. You can create three types of host files

  • Local. Created and saved on your Mac.
  • Remote. Create hosts file from URLs like the ones mentioned above
  • Combined. Combines local and remote hosts files.

When you change the hosts file, Gas Mask will also flush the DNS automatically.

That’s pretty much it. Gas Mask is a simple and intuitive hosts file manager that does its job.

NOTE: You can use this method in conjunction with an Ad-Blocker. If you are not comfortable messing with the host file, I advise you on using an Ad-Blocker anyway. There’s plenty of them available out there. I suggest using uBlock Origin