Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to add an entry to my hosts file on Snow Leopard. I could edit the hosts file with root user enabled, but in the system doesn't let me to save this file saying that I don't have permissions to make changes to this file since it's located in non-writable directory. How do i save changes there?



share|improve this question
up vote 7 down vote accepted

Try it from the command line:

sudo nano /private/etc/hosts

Type your user password when prompted for a password.

For more help, please refer to this blog posting:

Please note that you might have to reset the DNS cache with this command after changing the hosts file:

dscacheutil -flushcache

share|improve this answer
You can only use sudo if you're logged in as an administrator. If you're not an administrator do su -l <admin-account-name> first. – Steve Folly Jan 3 '10 at 14:54
well, i did it with vi (and i hate it). nano seems much more user friendly. Thanks anyway – Nava Carmon Jan 3 '10 at 15:54

Wat you could also do, is copying the file to anywhere else, and edit & save it from there. Now drag and drop it in finder in the /private/etc/ folder. It should ask for admin permissions; just type in your admin password. Also, you probably have to change permissions on the hosts file afterwards.

share|improve this answer
If you use this method be mindful of line endings. – ridogi Jan 3 '10 at 15:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.