The Mac hosts file is a system level file located at /etc/hosts which maps IP addresses to host names for Mac OS X networking. many users edit and modify the hosts file so that they can point a sphere to a different IP address, whether for the purpose of local development, blocking sites, or merely to access interchange servers from respective apps and arrangement level functions. Most promote users will edit the hosts file from the Mac OS X Terminal using nano or energy, but for those who prefer to stay within the Mac OS GUI, you can besides modify the Mac ’ south hosts file through TextEdit, or even a third party app like BBEdit or TextWrangler. This offers a more drug user friendly choice compared to going through the command line .
If you don ’ t have a specific reason to modify the Mac hosts file in macOS / Mac OS X, you should not do so. An incorrectly format hosts file or improper entry can lead to DNS issues and problems with respective internet services. This is for advanced users.
How to Modify the Mac Hosts File at /etc/hosts with TextEdit Mac OS
This approach to changing /etc/hosts with TextEdit works with any adaptation of Mac OS X. For Mac users who are running MacOS X 10.11 or later releases, you must first disable SIP protection however, differently the Mac /etc/hosts file will be locked when attempting to access it from TextEdit .
- Quit TextEdit if it is currently open
- Launch the Terminal application in Mac OS X, found within /Applications/Utilities/
- Enter the following command exactly to open the Macs hosts file within the TextEdit GUI application
- Hit return and enter the admin password for Mac OS X when requested to authenticate the launch through sudo
- The /etc/hosts file will launch into TextEdit as a plain text file where it can be edited and modified as need be, when finished use File > Save or hit Command+S as usual to save the changes to the hosts document *
- Quit out of TextEdit, then quit out of Terminal when finished
sudo open -a TextEdit /etc/hosts
* If the hosts file shows as “ locked ” and won ’ deoxythymidine monophosphate deliver changes despite being launched through sudo, it ’ s likely because you didn ’ triiodothyronine disable SIP as mentioned in the insertion. You can turn off SIP in Mac OS X with these instructions, which requires a boot of the Mac. This is necessary for modern versions of Mac OS X, though you can choose to edit the hosts file using the dominate occupation with nano as trace here without adjusting SIP .
It ’ south good practice to make a double of the hosts file so that if you break something you can easily fix it, though we ’ ve got the master default hosts file here in case you need to restore it. It ’ sulfur besides a good estimate to set complain text mood as the default for TextEdit .
You ’ ll likely want to clear out your DNS hoard after modifying the hosts file, hera ’ s how to flush DNS in Mac OS X El Capitan and advanced versions Mac OS and how to do the like in prior releases.
Users can besides choose to modify Mac OS X ’ s /etc/hosts with TextWrangler, BBEdit, or another third party application. The trick is largely the lapp as Text Edit, still requiring the use of sudo, but changing the specified application name as follows .
Opening /etc/hosts with TextWrangler :
sudo open -a TextWrangler /etc/hosts
Or launching /etc/hosts into Bbedit :
sudo open -a BBEdit /etc/hosts
While the aforesaid approaches work in all mod versions of Mac OS X, earlier versions of Mac OS X can besides launch the TextEdit binary star with hosts directly from the command line with the stick to syntax :
sudo ./Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts
That method will not work in the latest releases, however, thus you ’ ll want to rely on the afford control alternatively.
Read more: How to Make Your Own Website Without a Host
Know of another magic trick to modify the Mac hosts file in an easy fashion through TextEdit or another GUI app ? Let us know in the comments .