Mac OS X: Access Hosts File on Mac OS X Lion

On Mac OS X Snow Leopard and below it was possible to access the Hosts file using this command:

sudo /Applications/ /etc/hosts

In Mac OS X Lion this is no longer possible due to sandboxing.

The best option to access hosts file on Lion is Terminal:

sudo vim /private/etc/hosts

Any terminal editor will do (vi, vim, nano, etc).

Leave a Reply

Your email address will not be published.