How to edit mac “hosts” file

To find the hosts file, open Finder and, in Finder’s menu bar, select Go > Go to Folder. In the box, type the following location and press Return.

/private/etc/hosts

A new Finder window will open and your Mac’s hosts file will be selected. Click and drag it out of the Finder window and drop it on your desktop. This will let us freely edit the file.

To open it, simply double-click and it will display the file’s contents in TextEdit (or the text editor of your choice). By default, the hosts file is relatively simple. It contains a number of lines of descriptive text which are “commented out” with the pound or number sign (#). For each line, any text after the pound sign is ignored by the computer, making it a good way to add notes and descriptions to your files. It also contains default IP values for localhost and broadcasthost. To edit the file, you’ll add your own lines after broadcasthost.

You can add as many entries to the hosts file as you wish by entering new mappings on each line. Once you’ve made your desired changes to the hosts file, save it in its current location on the Desktop. Then, drag and drop the hosts file from your Desktop back to its original location at /private/etc. If you’ve closed the Finder window pointing to this directory, simply use the Finder > Go > Go to Folder command, discussed above, to reopen it.

When you drop the hosts file back in its original location, OS X will ask you what to do about the unmodified hosts file that’s already there. Choose “Replace” and then enter your administrative user password to authenticate the transfer.

Source & more @ https://www.tekrevue.com/tip/edit-hosts-file-mac-os-x/

Back to Top