Sign in to follow this  

Access Hosts File Mac OS X Lion

Recommended Posts

.Neo    1,834

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
Unrealistic    49

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
AlexMagik    20

sudo nano /etc/hosts

Share this post


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

once your done

ctrl+o then crtl+x
  • Like 2

Share this post


Link to post
Share on other sites
rajputwarrior    281

VI/VIM FTW!

  • Like 2

Share this post


Link to post
Share on other sites
+KoL    36

Terminal

sudo nano /private/etc/hosts

  • Like 1

Share this post


Link to post
Share on other sites
.Neo    1,834

Thanks The Protagonist and Kol! That did the trick!

Share this post


Link to post
Share on other sites
PurpleHaze420    36

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
chrispinto    12

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
PNWDweller    140

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
Elliott    235

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
Xtreme $niper    51

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
Elliott    235

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
giga    43

It's the sandbox.

efiDj.png

Share this post


Link to post
Share on other sites
offroadaaron    201

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
Xtreme $niper    51

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
allan.nyholm    31

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
allan.nyholm    31

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  

  • Recently Browsing   0 members

    No registered users viewing this page.