Edit hosts file in MAC OS X

In the last version Leopard, I use TextWrangler to edit my system configuration files, recently I’ve upgrade to OS X – Lion, since then when I try to save the edit hosts file i will get the [You do not have sufficient privileges to perform this operation (MacOS Error code: -5000)] error, I’ve try to edit the permission on the file and folder and that couldn’t help, so I look for another alternative and I found the following method to use for now.

Start the Terminal.app

terminal

Open the hosts file using nano

sudo nano /private/etc/hosts

Enter your system password when prompted.

Edit the hosts file and then use [control-o] to Save the file and [control-x] to exit nano editor.