One of the added security features to OS X Lion resulted in making edits to the OS X hosts file more difficult. This tutorial will show you how to edit the hosts file without having to use the Terminal or a complicated Application.
Please note: If you’re using OS X “Snow Leopard” (10.6) or lower, you’ll want to use this tutorial to edit your hosts file instead. The method outlined below is intended for Mac’s running OS X Lion (10.7) only.
- Start out by heading over to the TextWrangler download page and download TextWrangler.
TextWrangler is a free text editor for OS X, and is actually a great program (in addition to being required for this tutorial). Install it as you would with most OS X Apps – open the .dmg file and drag TextWrangler to your Applications folder.
Unlike most OS X Apps, you need to run this program once to complete the installation. So open your Applications folder and double-click TextWrangler to open it.
- You’ll be prompted to register TextWrangler, which is completely optional. Whatever you decide – make sure that Install the current command line tools is checked. Then click Skip Registration, Later or Register Now based on your decision.
- TextWrangler will now open – and now you can close it :)
- Open a Finder window and select Go from the Menu Bar, then Go to Folder… from the list.
- Enter in /etc then click Go.
- Inside the etc folder, locate the hosts file. Right-click (or control-click for single-button mouse folks) the hosts file, select Open With and then TextWrangler.
- TextWrangler will launch and open your hosts file.
- As soon as you make a change to the file, TextWrangler will display a message (see screenshot below) that says Are you sure you want to unlock “hosts”?. Since you do, click the Unlock button.
- Once you make your changes (and be careful – editing the hosts file incorrectly can cause a variety of problems) – save it. You’ll instantly be prompted to enter your password. Do so, and then click OK.
- That’s it – you’ve edited your hosts file.