This tutorial will guide you through the steps required to edit the hosts file in OS X.
Please Note: if you’re using OS X Lion (10.7), the method outlined below will not work. If you’re using Lion, see this tutorial to edit your hosts file. If you’re using OS X Snow Leopard (10.6) or earlier – the method outlined below will work just fine for you.
Note: editing the hosts file can have fairly adverse effects to your Mac if you’re not sure what you’re doing. This tutorial will show you how to edit it, but be careful doing so.
- Start out by opening a Terminal. To do so, open your Applications folder, select the Utilities folder, and then double-click Terminal.
- At the Terminal prompt, enter the following line:
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts
and then hit enter.
- At this point you’ll be prompted to enter your password. Do so, then hit enter.
- Your hosts file will now open in TextEdit. From here you can make any changes you deem fit/need.
- When you’re done, save the file.
- That’s it – you’re done. You can now close the Terminal. Should you ever need to re-edit your hosts file, follow the instructions from the beginning.