I have opened my hosts file using many ways many times.
But I find open hosts file with TextEdit is just the easiest for those who aren’t fan of using Terminal. I also wrote a tutorial of TextEdit and Time Machine here. If you want to use the Terminal, you can checkout OSXdaily tutorial.
I have posted how to open this file on Windows OS, and now I want to show you how to do it on a Mac.
It’s easy and simple.
1. Open your Finder, then go to the top menu, and click “Go” → “Go To Folder” or click these keys at once CMD + SHIFT + G
2. Type in or copy this path, and click “Go“:
3. In the “etc” folder, you will see a file, called, “hosts“.
4. Copy this file somewhere else to have a backup.
5. Then right click, choose “Open With” and select TextEdit (you can use other text editor, but TextEdit is just fine). And just hit “Enter”.
6. Click “Duplicate” if you see “You don’t have permission to write to the folder that the file “hosts” is in.” message.
7. Now, edit this hosts.txt file, and save this file to any folder you like, but in this post, I saved it in my desktop, as hosts.txt file.
8. Delete old hosts file in /etc folder, and move the hosts.txt from desktop to this folder.
You might see the Finder asks you for your Mac password.
9. Now you have a file, called hosts.txt inside /etc folder, next step is we remove .txt file extension.
Click “Remove” if it asks you whether you are sure to remove extension .txt.
We’ve done it! These steps are perhaps longer than editing in terminal, but to me, this is the easiest since I am not a terminal person.