DREADED - Uh-oh! Could not update hosts file Local ran into a problem when trying to update the hosts file. Please ensure that the hosts file is not locked by anti-virus

What issue or error are you experiencing?

LocalWP repeatedly displays the following error:

“Uh-oh! Could not update hosts file. Local ran into a problem when trying to update the hosts file. Please ensure that the hosts file is not locked by antivirus.”

I have confirmed the hosts file is editable manually without issue, and no antivirus software is installed or active.


What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc.

  1. Open LocalWP.
  2. Attempt to create or activate a new local site.
  3. The error immediately appears about failing to modify the hosts file.

Steps I’ve tried without success:

  • Running LocalWP explicitly as administrator.
  • Changing LocalWP compatibility settings (e.g., “Run as Administrator”, disabling fullscreen optimizations).
  • Explicitly setting file ownership of the hosts file to my user account with Full Control permissions.
  • Completely uninstalling antivirus software and temporarily disabling Windows Defender real-time protection.
  • Verifying via Resource Monitor that no other processes lock the hosts file.
  • Resetting LocalWP’s configuration and reinstalling LocalWP entirely.
  • Edit Hosts file directly without issue
  • Set to localrouter

Despite these actions, the issue persists.

Screenshot examples are attached.


System Details

  • Local Version: Version 9.2.2+6771

  • Operating System (OS) and OS version: Edition Windows 11 Pro
    Version 24H2
    Installed on ‎4/‎1/‎2024
    OS build 26100.3323
    Experience Windows Feature Experience Pack 1000.26100.54.0


local-lightning-verbose.log (514.2 KB)
Local Logs

(Attach logs following Local’s documentation on retrieving logs.)

Hi @dikdronk

With all the steps you’ve taken so far can you now try a full uninstall and reinstall of Local?

  • Export any sites that you have on Local and save them to a folder somewhere on your computer: Backup a Local Site - Local

  • Fully uninstall Local from your computer with the Windows specific steps here: Uninstall Local - Local

  • Install the latest version of Local on this link: Releases - Local

  • Once installed, please restart the computer.

  • When the computer is restarted and turned on, close any applications that automatically run in the background (AntiVirus, Firewall, and other Developer applications included).

  • Check and see if the issue still persists. If so, please provide us with an updated log: Retrieve Local’s Log File - Local

Ok, thanks, I will try this and check back. Is there no bulk export/import yet?

Do you have many sites in Local? You can go into the Local Sites folder to grab all of the site files at once and save them instead of exporting them one at a time.

Before you get started - Is this a personal device or one issued by your employer? If it’s not a personal device, it might have some extra security or permissions that an IT person can help with.

Otherwise, it seems like you’ve done all of the other checks here, but if you don’t want to go through the trouble of exporting/importing everything, it can’t hurt to double-check it all one more time.

Hi again! Not good news I am afraid. After spending an awfully long time of exporting, then deleting, then uninstalling, then rebooting and reinstalling, same exact issue.

local-lightning.log (3.1 KB)

To clarify you’re still getting the Hosts File error @dikdronk?

Is this a personal device you’re using? Or one issued by an employer?

Hi @Nick-B, yes, the same exact error on my personal device.

Could you share one more fresh log with us @dikdronk? Please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help us.

Sure thing @Nick-B ! Here you go :slight_smile:
local-logs.zip (11.4 KB)

Thanks for these logs and for your patience, @dikdronk.

Do you see an “allow this app to make changes” dialog box like this when creating new sites in Local?

If you do not see that at any point when creating new sites, you might be running into the same issue as the Local user from the thread linked below. They ended up resolving it by correcting some broken PATH variables on their machine. Click through for their helpful guide with screenshots, just in case you haven’t seen or tried that yet:

1 Like

Oh my goodness you are a genius!!! Sorted. Thanks so much my dude.

1 Like