1

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?

citrate
  • 111
  • 1
  • 1
    I think I'd look to see what oh-my-zsh might be doing. $HOST isn't a variable macOS sets, it's something zsh sets. – Marc Wilson Oct 15 '22 at 15:39
  • I found this answer about setting hostname by scutil. And on my computer, scutil --get HostName gives unset. However, it seems there's no way to revert it after scutil --set HostName <something>, and the reason $HOST variable changes is still unknown, so I don't want to solve the problem in this way. – citrate Oct 16 '22 at 06:40
  • I tried unset HOSTand started a new terminal, an echo $HOST gives the same value as scutil --get LocalHostName. It seems that the problem is temporarily fixed, but I still don't know why $HOST changed to my LAN IP. – citrate Oct 16 '22 at 06:48

0 Answers0