Local Community

Uh-oh! Could not update hosts file

Hi Pierre,

Sorry for the trouble!

Do you have any type of internet security or anti-virus installed? Some of them lock the /etc/hosts file.

Also, you may want to run First Aid on your macOS disk. See https://www.lifewire.com/repair-mac-drives-with-disk-utility-first-aid-4038562

Hi Clay,
Thanks for the link but i had already done that. I’ve tried to access to etc/host to with the mac terminal with sudo permission to make folder and files writable but it didn’t changed anything.
I have also stop my Little snitch network filter to give a try but its not the problem.

Do you have some command lines i can run from my terminal to give a new try on etc/hosts permissions ?

I have noticed something interesting, when i create a new host entry with Mamp pro (from the software interface) , Mamp Pro manage to edit etc/host file! test.dev # MAMP PRO - Do NOT remove this entry!
::1 test.dev # MAMP PRO - Do NOT remove this entry!

i can see all my local flywheel host entries in the same host file by the way.

So, etc/hosts is writable for Mamp Pro but not for Local Flywheel :grimacing:

I also have change the chmod permission like this but it didn’t t change anything:
sudo chmod 664 /private/etc/hosts

i also open etc/hosts in finder and change permissions for the user’s ‘wheel’ to read and write but i have noticed that after restart local fly wheel, the user ‘wheel’ is back to ‘read only’ permission…

Local By FlyWheel still can’t modify the etc/hosts on my machine. Any idea where this bug come from in your app? Mamp pro don’t have such problem…


Can you please open Terminal, enter ls -la /etc/hosts and provide the output?

Any update on this? I’ve been having the same issue for the past few weeks (right after an update).


Are you on macOS or Windows? Also, can you please provide your local-by-flywheel.log?

Hi Clay,

I’m on Mac OS X 10.11.6 (15G1611)
Log file is attached.local-by-flywheel.log (6.4 KB)

Hi Cecil,

Do you have a multisite subdomain site in Local? If so, it looks like WP-CLI is outputting more than it should.

Specifically, I’m seeing this. It might be caused by a syntax error in your wp-config.php.

** mysql settings - you can get this info from your web host **   define( 'disallow_file_edit', true );  define('wp_post_revisions', false);  disable php error reporting which includes server file path  enable debug logging to the   enable wp_debug mode  force ssl

That’s right, there are a couple of sub-domain multisites.

Hi Clay,
I have opened my terminal and entered the command you have provided me and here is my output:

-rw-r--r--@ 1 root wheel 802 18 jul 23:00 /etc/hosts

What is the human traduction ? thanks


In Local 2.0.6 do you see an error when Local tries to update the hosts file?

Hi @clay in my local log file i have this

error: [main/hosts-helper] Could not update hosts. 
{ stdout: undefined,
  stderr: undefined,
  error: { code: 2 },
  exitCode: 2 }

and in my local by flywheel software, when i try to start a site, local ask me my macbook system password and than i have a popup saying

Uh-oh! could not update hosts file

did i mentioned that in the past i have tried to install trellis, but i have removed the folder from my computer

maybe there is a conflict somewhere with that?

sometimes, i have also this error when i try to launch local by flywheel :

info: [main/docker-machine-nfs] Enabling Docker Machine NFS
Aug 24, 2017, 4:11 PM GMT+2 - warn: [main/index] Unhandled Rejection at: Promise  Promise {
  <rejected> { error: 
   { Error: Command failed: sh "/Applications/Local by Flywheel.app/Contents/Resources/extraResources/shell-scripts/nfs-configure-mac.sh" "" "501" "20"
   exports:2: path contains non-directory or non-existent components: /Users/Mecanographik/dev-sage/example.com/site
   exports:2: no usable directories in export entry
   exports:2: using fallback (marked offline): /
   exports:5: /Users conflicts with existing export /Users/Mecanographik/dev-sage/example.com/site
       at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/node_modules/sudo-prompt/index.js:329:27
       at tryToString (fs.js:426:3)
       at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:413:12) code: 4 },
  stdout: undefined,
  stderr: undefined,
  exitCode: 4 } }  reason:  
{ error: { code: 4 },
  stdout: undefined,
  stderr: undefined,
  exitCode: 4 }

@ceciljchen @mecanographik

It looks like there might be syntax errors in one of your site’s wp-config.php files. It’s causing additional output in the WP-CLI command that fetches the subdomains for the multisite site.

I would make sure that the wp-config.php files for the multisites look correct.


As far as the NFS issue goes, you can try opening /etc/exports with nano in Terminal (full command would be sudo nano /etc/exports).

You can remove every line in there and save it. Then, re-open Local.

1 Like

Thanks @clay the etc/exports command was useful to edit a vagrant old record i didn’t need anymore, than after i have fixed the NFC issues, Local By flywheel was starting nicely again. :grin:
Than i have also fixed my other big issues which was the unwritable hosts file. i have backed up and remove one of my local site, the one who was multi site mode, than the etc hosts file was writable again. Thanks so much Clay, you’re brillant! :star_struck:

Glad you got it working! :smiley: