Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mountain Lion 10.8.2 (Hosts File Locked)

In OS X Lion 10.7, I had edited my Hosts File to prevent certain web-sites from loading and would like to access them again, however I have noticed that in the latest update of Mountain Lion 10.8.2 the "/private/etc/hosts" file is locked and cannot even be modified in terminal using vi, nano or pica. Does anyone know a way around this? I even tried logging into to the repair volume of OS X to try to no luck. Has anyone been successful?

iMac (21.5-inch Late 2009), OS X Mountain Lion (10.8.2)

Posted on Oct 24, 2012 9:03 PM

Reply
Question marked as Best reply

Posted on Oct 24, 2012 10:50 PM

Okay, after a ton of researching terminal commands, I finally found the solution to my own question.


1) First you need to log-in as the Root User in Terminal using the following command:


sudo su -


2) Then you need to remove the "sticky" lock assigned to the hosts file that prevents people from modifying it:


chflags nouchg /private/etc/hosts


3) Then you can edit the hosts file as per usual via the following command:


sudo nano /private/etc/hosts


"Control O" to Save

"Control X" to Exit


4) Then in Mountain Lion you should flush your cache to ensure the new hosts file is current:


sudo killall -HUP mDNSResponder


5) Go ahead and reapply the "sticky" lock so the hosts file doesn't modify itself:


chflags uchg /private/etc/hosts


I hope this helps!

1 reply
Question marked as Best reply

Oct 24, 2012 10:50 PM in response to 2 Time Olympian

Okay, after a ton of researching terminal commands, I finally found the solution to my own question.


1) First you need to log-in as the Root User in Terminal using the following command:


sudo su -


2) Then you need to remove the "sticky" lock assigned to the hosts file that prevents people from modifying it:


chflags nouchg /private/etc/hosts


3) Then you can edit the hosts file as per usual via the following command:


sudo nano /private/etc/hosts


"Control O" to Save

"Control X" to Exit


4) Then in Mountain Lion you should flush your cache to ensure the new hosts file is current:


sudo killall -HUP mDNSResponder


5) Go ahead and reapply the "sticky" lock so the hosts file doesn't modify itself:


chflags uchg /private/etc/hosts


I hope this helps!

Mountain Lion 10.8.2 (Hosts File Locked)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.