Hostname is exists.ptr.local

Did your hostname looks something like this?

> hostname
192.168.71.102.non-exists.ptr.local

I was expecting hostname to return URMAC but it doesn’t. What the hell is .non-exists.ptr.local?. Is this somekind of magic caused by Warp, Tailscale or my wifi configuration?. I searched for “non-exists.ptr.local” in Google and got 0 result. What!

Turn our, there are 3 kinds of hostname in MacOs (thank to ChatGPT).

> scutil --get HostName
> scutil --get LocalHostName
> scutil --get ComputerName
  • HostName: Used for the system’s public name (e.g., for SSH).
  • LocalHostName: Used for Bonjour/mDNS (this is what you’ll see in .local).
  • ComputerName: What appears in the UI (like AirDrop, System Settings, etc.)

The hostname command use the first kind of hostname and my machine does not have a one.

> scutil --get HostName
HostName: not set

OK, I will set one

> sudo scutil --set HostName URMAC

And it works

> hostname
URMAC