The Mac hosts file is located inside a folder /etc/hosts which used by OS system to map the hostnames (domain name) to IP addresses.
The Use of Mac Hosts File
Commonly the Mac host file is modified for the following reasons:
To block the site’s page. You can use the Mac hosts file to block harmful sites like porn sites, or to block social media that may gets you unproductive, like block facebook.
To block advertisements. Besides blocking ads, it can also block banners, 3rd party cookies, 3rd party page counters, web bugs, and even most hijackers.
To propagate DNS when the hosting is moved. If you plan to move your site’s hosting to other providers, and you want the process runs faster without you need to wait for DNS propagation, then you can redirect the site’s address to the new IP hosting.
Why to Use Gask Mask (Mac)
The hosts file on your Mac which is located inside folder /etc/ cannot be edited directly using TextEdit application because the hosts file is locked by the system.
In order to do that, you can use nano editor in Terminal through command line:
sudo nano /etc/hosts
However, if you are an beginner user, such step is a bit difficult because you need to remember the command and enter that command line.
Afterward, you need to do a Flush DNS 11.Flush DNS is clearing cache DNS inside your Mac’s system × with command of:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed
Therefore, you can still do the editing with ease using an application called Gas Mask (Mac).
What is Gas Mask (Mac) anyway?
Gas Mask (Mac) is a free application (open source) which can be used as Hosts file manager, hosts files editor and switch between them.
Having not only Editor Window to edit hosts file, Gas Mask offers you a service to produce several hosts file Profile such as, Original Hosts File, Block Ads, and Block SocMed, plus we can easily change the hosts file profile by only clicking the icon Gas Mask on menu bar.
Gas Mask Menu Bar Icon
By activating the Hosts file profile we want, the Gas Mask (Mac) will automatically run the flush DNS.
3 Types Gas Mask (Mac) Hosts File:
Local. This type hosts file will created and saved on your local Mac Computer.
Remote. With this, you can create hosts file by adding url collection of blocked sites like http://someonewhocares.org/hosts/ or http://winhelp2002.mvps.org/hosts.htm.
Combined. You can combining local and remote hosts.