I'm using zsh and oh-my-zsh on macOS Monterey 12.6, and I found that sometimes the hostname changes to 192 automatically. After having a check, I found sometimes environment variable $HOST becomes my LAN IP, which starts with 192 automatically.
How can I fix that variable to a desired value? Do I need to set it in cli or gui? Is there any possible reason that it changes to my LAN IP?
$HOSTisn't a variable macOS sets, it's somethingzshsets. – Marc Wilson Oct 15 '22 at 15:39scutil. And on my computer,scutil --get HostNamegives unset. However, it seems there's no way to revert it afterscutil --set HostName <something>, and the reason$HOSTvariable changes is still unknown, so I don't want to solve the problem in this way. – citrate Oct 16 '22 at 06:40unset HOSTand started a new terminal, anecho $HOSTgives the same value asscutil --get LocalHostName. It seems that the problem is temporarily fixed, but I still don't know why$HOSTchanged to my LAN IP. – citrate Oct 16 '22 at 06:48