Warning! Missing hosts entry. 6 months later... I still can't set up local

Hey guys, after much back-and-forth over the past 6 months with Jordan… I’ve been asked to post here and see if we can’t get this working.

I’ve installed the latest version of local and tried to set up a new site.

I get an orange bar at the top saying “Warning! Missing hosts entry. This site may be inaccessible.” when I click on “Fix it”, nothing happens.

I’m using the mac version.

Any troubleshooting tips would be much appreciated!

Thanks

Mike

Make sure to try the Local site while you are not using any VPN client, and/or any DNScrypt service.

Did spent a lot of time debugging why Local wasn’t playing nice on one computer. Played out it was a VPN client which wasn’t even connected to the VPN, it was just running, but had an inbuilt firewall which blocked Local. So make sure you turn off any vpn client and/or dnscrypt clients to test if it helps.

Thanks for replying so quickly. I had a VPN running previously and I’m not sure what a DNScrypt is so I can only imagine I don’t have anything like that running.

I powered down, started up and didn’t start the VPN. Tried to set up a new site on local and I’m getting the same message, still nothing happens when I click “Fix It”.

When I click on “Admin” I get:

“This site can’t be reached
This site on the company, organisation or school intranet has the same URL as an external website.
Try contacting your system administrator.
ERR_ICANN_NAME_COLLISION”

The site url was http://testthislocal12819idk.dev/wp-admin so I can’t imagine this error being valid unless it was a total coincidence?

Hi Mike,

When you click “Fix It” do you see an admin password prompt?

If you check your /etc/hosts file do you see entries for your Local sites?

Finally, are you using something like Gas Mask?

Hi Clay, I don’t see anything at all when I click “Fix It”… nothing happens.

No entries for the Local sites in /etc/hosts

I’m not using something like Gas Mask.

thx Clay

Hi Mike,

Recently we found out the main reason why this would happen on Windows (I know you’re on macOS) is due to internet security/firewall suites locking the hosts file.

I’m not sure how common this is for macOS security programs, but if you’re running an anti-virus, internet security, etc., you may want to see if there’s a “Host file lock” option or similar.

The only think I thought might affect it was a VPN client called mullvad but I have since tried using local without the VPN running and it didn’t change anything.

I don’t use any other security programs.

Would my current installation of MAMP have any effect?

MAMP shouldn’t have any effect.

Can you try following this tutorial? https://www.imore.com/how-edit-your-macs-hosts-file-and-why-you-would-want. I’m curious to know if sudo nano will work on your system.

You can add a simple line such as 127.0.0.1 testing.dev.

When I open the hosts file using terminal It doesn’t seem to have any information (not like they show in the tutorial at least).

This is what I see:

Hey Mike,

That’s extremely odd. First, can you try running cat /private/etc/hosts in Terminal and see if there is anything? Also, run ls -la /etc and provide the output of that.


If not, I would check for the following again:

  1. Any anti-virus or internet security products that may be locking/changing it. Here are some examples:

    • Sophos
    • Bitdefender
    • Thor AntiVirus
    • Kaspersky
  2. Any VPN, proxy, etc. that may be locking/changing it. Here are some examples:

    • TunnelBear
    • Private Internet Access
    • TorGuard
  3. Software that manages the /etc/hosts file

    • GasMask

If you do not have anti-virus then I would look into at least trying a free one to scan your computer since the /etc/hosts file is a sensitive file and can redirect traffic in malicious ways.

Also, I would try First Aid in macOS’s Disk Utility. See https://blog.macsales.com/38008-rocket-yard-guide-using-macos-sierra-disk-utility-to-verify-or-repair-disks

cat /private/etc/hosts returned: “No such file or directory”

ls -la /etc returned: lrwxr-xr-x@ 1 root wheel 11 Nov 16 2016 /etc -> private/etc

  1. I’m not running any anti-virus or internet security (that I know of), and have checked specifically for those examples you gave.

  2. I use the VPN “Mullvad”, but don’t have it running at the moment and ensure it’s not running when trying anything with Local. Could it have installed something that is interfering even when it’s not running?

  3. Not running GasMask or anything else managing /etc/hosts file (again, that I know of)

Others
I downloaded Sophos Home and ran a full scan. Nothing was picked up except “adminer” as part of MAMP and after some reading, it seems this is common and a false positive.

I tried running First Aid and it returned no issues.

1 Like

Thanks for the reply!

I’d follow this guide for restoring your hosts file: https://www.igeeksblog.com/how-to-reset-restore-hosts-file-to-its-original-version-in-mac-windows/

After that, you can try having Local edit the hosts file.

I followed the guide… restarted… opened Local, downloaded and installed the update, created a new site and I immediately get the same error.

“Warning! Missing hosts entry. This site may be inaccessible.”

When I click “FIX IT” it does nothing.

Can you run the following command again and provide the output?

cat /private/etc/hosts
1 Like

again it says “No such file or directory”

Please try the following to recreate the hosts file.

sudo sh -c 'echo "##\n# Host Database\n#\n# localhost is used to configure the loopback interface\n# when the system is booting.  Do not change this entry.\n##\n127.0.0.1 localhost\n255.255.255.255      broadcasthost\n::1             localhost" > /etc/hosts'

Then, you can try the cat command again.

1 Like

AMAZING!!

That did it :slight_smile:

…thanks so much for your patience to work through this with me Clay.

3 Likes

Rock on, glad it helped!

1 Like