Sign in to follow this  
Followers 0
.Neo

Access Hosts File Mac OS X Lion

18 posts in this topic

On Mac OS X Snow Leopard and below I used to be able to access the Hosts file using this command:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

However, after installing Mac OS X Lion today I can't anymore. Any suggestions how to open and edit the file? Thanks in advance.

Share this post


Link to post
Share on other sites

On Mac OS X Snow Leopard and below I used to be able to access the Hosts file using this command:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

However, after installing Mac OS X Lion today I can't anymore. Any suggestions how to open and edit the file? Thanks in advance.

I always just use TextWrangler to edit it. Sudo worked for me though (not using TextEdit.app).

Share this post


Link to post
Share on other sites

sudo nano /etc/hosts

Share this post


Link to post
Share on other sites
sudo nano /etc/hosts

once your done

ctrl+o then crtl+x
2 people like this

Share this post


Link to post
Share on other sites

VI/VIM FTW!

2 people like this

Share this post


Link to post
Share on other sites

Terminal

sudo nano /private/etc/hosts

1 person likes this

Share this post


Link to post
Share on other sites

Thanks The Protagonist and Kol! That did the trick!

Share this post


Link to post
Share on other sites

I didn't know how to achieve this through Terminal, will come in handy. Thanks. :)

Share this post


Link to post
Share on other sites

Terminal all the way for quick hosts file editing

Then a quick reboot or could just flush the cache for 'instant' updating

Share this post


Link to post
Share on other sites

Looks as ifGasmask for Macwill work on Lion and that also lets you edit your hosts files in a Gui.

Share this post


Link to post
Share on other sites

Then a quick reboot or could just flush the cache for 'instant' updating

Does OS X really cache entries from the hosts file? Seems weird to me.

Share this post


Link to post
Share on other sites

Still doesn't really explain why he can't use TextMate to edit the file anymore...?

Share this post


Link to post
Share on other sites

Still doesn't really explain why he can't use TextMate to edit the file anymore...?

TextEdit, not TextMate. You can still use TextMate just fine. The problem probably has something to do with sandboxing in Lion.

Share this post


Link to post
Share on other sites

Terminal all the way for quick hosts file editing

Then a quick reboot or could just flush the cache for 'instant' updating

You don't need to reboot LOL's

Share this post


Link to post
Share on other sites

TextEdit, not TextMate. You can still use TextMate just fine. The problem probably has something to do with sandboxing in Lion.

Ahhh crap, I misread. Thanks.

Share this post


Link to post
Share on other sites

There's an application called Gas Mask that can edit the Hosts file on the Mac quiet easily - even allow for subscriptions to anti-malware and adblock Hosts files from this site: http://winhelp2002.mvps.org/hosts.htm.

Gas Mask is available here http://www.clockwise.ee/gasmask - it also has a Google Code page here: http://code.google.com/p/gmask/

Share this post


Link to post
Share on other sites

There's an application called Gas Mask that can edit the Hosts file on the Mac quiet easily - even allow for subscriptions to anti-malware and adblock Hosts files from this site: http://winhelp2002.mvps.org/hosts.htm.

Gas Mask is available here http://www.clockwise.ee/gasmask - it also has a Google Code page here: http://code.google.com/p/gmask/

I've just realized that I 'double recommended' the Gas Mask application. An oversight on my part.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.