New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Mountain Lion Hosts File


Post Reply New Thread Subscribe

 
Thread Tools
Shikarnov

 
Shikarnov's Avatar
 
Member Since: Feb 26, 2008
Posts: 542
Shikarnov is a jewel in the roughShikarnov is a jewel in the roughShikarnov is a jewel in the rough

Shikarnov is offline
Hi All,

First, please know I'm well aware of how to edit the Hosts file using Terminal... But what I really want to do is edit it using Smultron 4 (which I'd done in the past with Lion and Snow Leopard). That said, I just can't seem to defeat Apple's security in Mountain Lion... Now, setting aside the security implications -- and I know some of you have strong feelings about users being "rightly" disallowed dominion over their own computers -- do any of you have advice on how I can accomplish my desired goal of editing my Hosts file using any text-editing application I want?

Things I've tried already:
  • Changing permissions on the Hosts file using the Get Info window to give myself read/write privileges
  • Taking ownership of the file
  • AppleScript (do shell script "open /Applications/Smultron\\ 4.app/ /etc/hosts" with administrator privileges)
  • Changing permissions for the entire ETC folder (which works - but is somewhat less than ideal given that it leaves everything else exposed that doesn't need to be)

Thanks in advance!

Z
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,815
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is online now
First off, don't take any route that involves changing permissions. There's a difference between having control over the filesystem and deferring to the Unix system of permission management.

Try the following:
Code:
sudo /Applications/Smultron\ 4.app/Contents/MacOS/Smultron /etc/hosts

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
Shikarnov

 
Shikarnov's Avatar
 
Member Since: Feb 26, 2008
Posts: 542
Shikarnov is a jewel in the roughShikarnov is a jewel in the roughShikarnov is a jewel in the rough

Shikarnov is offline
That did the trick. Thank you!

For anybody else that edits the host file frequently, Using Vansmith's detail, I created an AppleScript with the following code, so I can keep an icon on my dock next to MAMP.

Code:
do shell script "sudo /Applications/Smultron\\ 4.app/Contents/MacOS/Smultron\\ 4 /etc/hosts" password "mypassword" with administrator privileges
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,815
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is online now
No problem, glad I could help.

One piece of advice (for anyone out there) - make a backup of a working hosts file before you do this, especially if the hosts file is new to you.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,075
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
I just use Gasmask. Lot easier.
Download Gas Mask for Mac - Hosts file manager, edit hosts files and switch between them. MacUpdate.com

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks

Post Reply New Thread Subscribe


« How come I cannot delete some files? | Java not updating correctly... Or at all? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Errors when trying to install Mountain Lion Tarek OS X - Operating System 1 07-29-2012 07:10 PM
Apple briefly releases Mountain Lion Up-to-Date program, pulls it back OneMoreThing... Apple Rumors and Reports 0 07-23-2012 04:50 PM
Sims 2 Crashing in new OS (Lion) possible file limit issue dragonfly3007 OS X - Apps and Games 7 05-28-2012 02:58 PM
OS X Lion Version control, the File menu, and me OneMoreThing... Apple Rumors and Reports 0 07-27-2011 01:48 PM

All times are GMT -4. The time now is 03:49 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?