Let’s get to the bottom of it.
There are quite a bunch of hostnames that macOS is using. hostname
is just one of them.
For example, look what’s reported on my machine:
alex@alexmbp ~ % scutil --get HostName
HostName: not set
alex@alexmbp ~ % scutil --get LocalHostName
alexmbp-3
alex@alexmbp ~ % scutil --get ComputerName
alexmbp
alex@alexmbp ~ % hostname
alexmbp.home.saspus.com
See what happened here? my Mac has at least three hostnames here: especially interesting is local hostname – note -3
suffix? That’s because I had a bunch of my older MacBooks pros, named the same, still powered, sitting around.
I’m not sure which of those hostnames is duplicacy using but if it is “LocalHostName” – then this would explain your issues.
Check what do you see on your machine, then you can force all the hostnames to the same something using --set
instead of --get
above