Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kmj2318

macrumors 68000
Original poster
Aug 22, 2007
1,669
712
Naples, FL
For some reason I can't get this to work after the Sierra update. Any body else?

Btw, here's what I'm trying to do, just in case I'm making an error that someone can point out.

mddVJZC.png
 
It is much easier to do this with a GUI rather than Terminal. TextEdit won't work, but the freeware TextWrangler will. Download it from here: http://www.barebones.com/products/TextWrangler/

You have got to be joking does it even allow you to authenticate to edit a system file. Well to answer my own question after firing up my copy here it does not even allow you to open the /etc/hosts file even after allowing the hidden files which it is to supposedly be opened. To the OP I take it you have started the edit with sudo nano /etc/hosts?
 
I saw in an article that you may need to use the command below to flush DNS cache after editing the the host file. Let us know if it helps.

Code:
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
 
Facebook enforces the ‘www’ sub-domain, so you have to include that. /etc/hosts does not resolve sub-domains, you have to be explicit. You also need to reboot to see the change (as the comment at the top implies).

I hope you made a backup before editing this file.
 
Last edited:
@MacUser2525:

I don't know why you are having problems opening the Hosts file with TextWrangler. I have been using it for years to edit my Host file with no problem.

Just to double-check to make sure the newest version of TextWrangler hadn't changed anything, I download a fresh copy. I found it would open the hosts file after checking "show hidden files".

In truth, that is not what I usually do. I usually pull down the Go menu in Finder and choose Go to Folder and then type /etc into the box. Then I navigate to the hosts file, right click and choose Open With, then Other, then TextWrangler.

I am using El Capitan, so can't say if anything has changed on Sierra.

Is the version of TextWrangler that you have one that was downloaded directly from Bare Bones Software as per my link above, or did you download it from the App Store? The App Store version is different and cannot be used to edit the hosts files: http://www.barebones.com/support/textwrangler/faqs.html

Scooby is correct that the changes to the hosts file will not be effective until you clear the DNS cache or reboot.
 
I am using El Capitan, so can't say if anything has changed on Sierra.

Is the version of TextWrangler that you have one that was downloaded directly from Bare Bones Software as per my link above, or did you download it from the App Store? The App Store version is different and cannot be used to edit the hosts files: http://www.barebones.com/support/textwrangler/faqs.html

Scooby is correct that the changes to the hosts file will not be effective until you clear the DNS cache or reboot.

3.5.3 downloaded from their site ages ago on El Capitan I don't use the App store perhaps to old to have that capability. Most times I fail to see the point jumping through hoops to get something like this done as I always have a Terminal window open it is a simple Command Tab to switch to it. Then a quick bit of typing using again the Tab key auto completion for the file I need to edit and do in seconds, could probably do ten files or more in the time the fancy GUI method would take.
 
Current version of TextWrangler is 5.5.2. Not surprising yours didn't work.

Many people prefer to use a GUI if it is available rather than memorize terminal commands.
 
Current version of TextWrangler is 5.5.2. Not surprising yours didn't work.

Many people prefer to use a GUI if it is available rather than memorize terminal commands.

That and the scared of text factor I have no such fear when I started using these things before there even was personal computers there was nothing but that, now get off my lawn...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.