Problem:
I've got two macs in the same network. One of them is often not discoverable via the Finder or Apple Music (shared library). I noticed that this mac has incorrect hostnames in the sharing preferences. When I change the hostname in the text field to bestHostname, the blacked out parts won't change. Instead they show something like phils-imac.domain.
The other mac is always discoverable and sharing preferences show up the correct hostname.
What I tried:
When I type sudo hostname
into the terminal, the correct hostname appears (the purpled out one). I even tried sudo scutil --set HostName bestHostname
to set the hostname via terminal, but system preferences still does not change it.
I even restarted the mac. Nothing helped.
Any ideas on how to fix this?