AlexTheHopeful

Q: Safari ignores hosts file

Safari (v9.0) seems to ignore the /private/etc/hosts file after I updated from Yosemite 10.10.3 to 10.10.5. My file looks like this:

---

 

##

# Host Database

#

# localhost is used to configure the loopback interface

# when the system is booting.  Do not change this entry.

##

127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

fe80::1%lo0 localhost

127.0.0.1 www.youtube.com youtube.com

fe80::1%lo0 www.youtube.com youtube.com

---

 

Characters seem to be ok: cat -vet /private/etc/hosts yields

 

---

$

##$

# Host Database$

#$

# localhost is used to configure the loopback interface$

# when the system is booting.  Do not change this entry.$

##$

127.0.0.1^Ilocalhost$

255.255.255.255^Ibroadcasthost$

::1^Ilocalhost$

fe80::1%lo0^Ilocalhost$

127.0.0.1^Iwww.youtube.com youtube.com$

fe80::1%lo0^Iwww.youtube.com youtube.com$

---

 

General resolving mechanism seems to work: Both ping and dscacheutil -q host -a name www.youtube.com yield 127.0.0.1 as IP address. But the site is not "blocked". Clearing the browser cache does not help.

Any help is MUCH appreciated.

MacBook Pro with Retina display, OS X Yosemite (10.10.5)

Posted on Oct 13, 2015 3:16 PM

Close

Q: Safari ignores hosts file

  • All replies
  • Helpful answers

  • by AlexTheHopeful,Solvedanswer

    AlexTheHopeful AlexTheHopeful Oct 16, 2015 9:46 AM in response to AlexTheHopeful
    Level 1 (2 points)
    Oct 16, 2015 9:46 AM in response to AlexTheHopeful

    Ok, I found the solution. For some reason using an alias after the official host name (as specified in man hosts) does not work with Safari 9.0 and Yosemite 10.10.5 any more. I have to start a new line for each alias. This works:

     

    ---

    127.0.0.1 localhost

    255.255.255.255 broadcasthost

    ::1 localhost

    fe80::1%lo0 localhost

    127.0.0.1 www.en.wikipedia.org

    fe80::1%lo0 www.en.wikipedia.org

    127.0.0.1 en.wikipedia.org

    fe80::1%lo0 en.wikipedia.org

    ---

  • by Randy Worden,

    Randy Worden Randy Worden Aug 29, 2016 8:24 PM in response to AlexTheHopeful
    Level 1 (4 points)
    Mac OS X
    Aug 29, 2016 8:24 PM in response to AlexTheHopeful

    My file is:

     

    ##

    # Host Database

    #

    # localhost is used to configure the loopback interface

    # when the system is booting.  Do not change this entry.

    ##

    127.0.0.1 localhost

    255.255.255.255 broadcasthost

    ::1             localhost

    127.0.0.1 citrixonline.com

    127.0.0.1 fastsupport.com

    127.0.0.1 citrix.com

    127.0.0.1 www.citrix.com

     

    With same problem!