SOLUTION: Uh-oh! Could not update hosts file

I had the dreaded “Uh-oh! Could not update hosts file” on Mac Ventura. I tried all the solutions listed here, and a whole bunch of other stuff.

I then thought, right I’m going to try DevKinsta instead, and what do you know? I got basically the same error - however, there was a bit more info in the error message.

I noticed a script called osascript was failing, so I dug in…

  1. Try osascript -e beep in terminal. If it throws an error, then you have the same issue I had. If you hear a beep, sorry, you’re on your own (it’s meant to make a beep noise).
  2. I found this post on Reddit:

The post:

I know this is an old post, but I wanted to mention I just ran into basically the same thing and this post (and this post on the Apple Developer Forum) helped me solve my problem!

To help anyone else with a similar issue find this… I’m running macOS Monterey (12.4), and found that Script Editor was completely broken. Compiling or trying to run any script would not work. The app reported frequent autosave errors. Even saving a .applescript text file would not work. Trying to open a scripting dictionary wouldn’t do anything. Opening Script Editor’s preferences would not show any options under “Default Language”. osascript -e beep would fail with 'osascript: can't open default scripting component.' And finally, osalang -L would not return an AppleScript component, but sudo osalang -L interestingly would.

Trashing Script Editor’s preference file didn’t help. Restarting in Safe Mode and trying the same steps didn’t help. Clearing the “Open Recent” menu as noted here seemed to have an affect, as the app appeared to refresh, but it ultimately didn’t change anything.

I couldn’t quite get dtruss to behave, but I found an alternative.

To find the fix:

  • Open two terminals and in one terminal run:
    • sudo fs_usage -w -f filesys osalang | grep Library/
    • This will attempt to list file system events triggered by the osalang command, and will filter the output to only list events having to do with files with “Library/” in their path (where problems are likely to occur).
  • In the other terminal run:
    • osalang -L
    • Normally, this tries to list the available osa scripting language components.

In the output, I found unexpected opens being issued to an audio plug-in that I completely forgot I tried to install. After removing the non-operative Audio plug-in and reopening Script Editor, everything I noted above worked properly!

  1. After running this process above, I found an audio module in /Users/[username]/Library/Audio/Plug-Ins/Components
  2. I duplicated the folder and called it “Components.bkp”, then deleted everything inside “Components” (I had one .component file in there). Note that it’s not enough to rename the component itself.
  3. After doing that, I ran the beep test again and it worked! Spun up local and I got the password prompt instead of the hosts file error!
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.