.Neo Posted July 21, 2011 Share Posted July 21, 2011 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. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/ Share on other sites More sharing options...
Unrealistic Posted July 21, 2011 Share Posted July 21, 2011 On 21/07/2011 at 01:18, .Neo said: 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). Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594176350 Share on other sites More sharing options...
AlexMagik Posted July 21, 2011 Share Posted July 21, 2011 sudo nano /etc/hosts Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594176354 Share on other sites More sharing options...
iuerg87yerg879e0rg9erugjer Posted July 21, 2011 Share Posted July 21, 2011 Quote sudo nano /etc/hosts once your done Quote ctrl+o then crtl+x .Neo and offroadaaron 2 Share Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594176358 Share on other sites More sharing options...
rajputwarrior Posted July 21, 2011 Share Posted July 21, 2011 VI/VIM FTW! ryokovv006 and offroadaaron 2 Share Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594176362 Share on other sites More sharing options...
KoL Veteran Posted July 21, 2011 Veteran Share Posted July 21, 2011 Terminal sudo nano /private/etc/hosts .Neo 1 Share Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594176364 Share on other sites More sharing options...
.Neo Posted July 21, 2011 Author Share Posted July 21, 2011 Thanks The Protagonist and Kol! That did the trick! Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594176544 Share on other sites More sharing options...
PurpleHaze420 Posted July 21, 2011 Share Posted July 21, 2011 I didn't know how to achieve this through Terminal, will come in handy. Thanks. :) Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594178210 Share on other sites More sharing options...
chrispinto Posted July 21, 2011 Share Posted July 21, 2011 Terminal all the way for quick hosts file editing Then a quick reboot or could just flush the cache for 'instant' updating Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594178220 Share on other sites More sharing options...
PNWDweller Posted July 21, 2011 Share Posted July 21, 2011 Looks as ifGasmask for Macwill work on Lion and that also lets you edit your hosts files in a Gui. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594178228 Share on other sites More sharing options...
Elliott Posted July 21, 2011 Share Posted July 21, 2011 On 21/07/2011 at 17:07, chrispinto said: 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. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594178258 Share on other sites More sharing options...
Xtreme $niper Posted July 21, 2011 Share Posted July 21, 2011 Still doesn't really explain why he can't use TextMate to edit the file anymore...? Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594178916 Share on other sites More sharing options...
Elliott Posted July 21, 2011 Share Posted July 21, 2011 On 21/07/2011 at 19:40, Xtreme $niper said: 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. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594179178 Share on other sites More sharing options...
giga Veteran Posted July 21, 2011 Veteran Share Posted July 21, 2011 It's the sandbox. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594179206 Share on other sites More sharing options...
offroadaaron Posted July 21, 2011 Share Posted July 21, 2011 On 21/07/2011 at 17:07, chrispinto said: 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 Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594179536 Share on other sites More sharing options...
Xtreme $niper Posted July 21, 2011 Share Posted July 21, 2011 On 21/07/2011 at 20:41, Elliott said: 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. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594179566 Share on other sites More sharing options...
allannyholm Posted November 29, 2011 Share Posted November 29, 2011 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/ Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594483885 Share on other sites More sharing options...
allannyholm Posted November 30, 2011 Share Posted November 30, 2011 On 29/11/2011 at 16:40, allan.nyholm said: 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. Link to comment https://www.neowin.net/forum/topic/1013632-access-hosts-file-mac-os-x-lion/#findComment-594484899 Share on other sites More sharing options...
Recommended Posts