Mac How to Open Hosts File with TextEdit

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.

Steps

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

Finder Go To Folder on the menu and shortcut keys
Finder Go To Folder on the menu and shortcut keys

2. Type in or copy this path, and click “Go“:

/private/etc/

Location of hosts file in Mac
Location of hosts file in Mac

3. In the “etc” folder, you will see a file, called, “hosts“.

4. Copy this file somewhere else to have a backup.

[pdtad]

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.

ou don't have permission to write to the folder that the file "hosts" is in
Hosts file is locked

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.

Edited hosts file with TextEdit on Mac
Edited hosts file with TextEdit on Mac

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.

Finder prompt you to enter Mac password
Finder prompt you to enter 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.

Click remove if you are sure you want to remove the extension
Click remove if you are sure you want to remove the extension

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.

1 thought on “Mac How to Open Hosts File with TextEdit”

Comments are closed.