The results of running the following commands on macOS Ventura 13.6:
$ scutil --get HostName
HostName: not set
$ hostname
DESKTOP-XXXXXXX
Note: XXXXXXX
is a placeholder for a code that's unfamiliar to me, and which consists of random uppercase letters and digits. I haven't touched these settings. How is it possible that they return different things?
man scutil
says regarding the HostName
option:
HostName The name associated with hostname(1) and gethostname(3).
What's the difference between hostname
and scutil --get HostName
?
DESKTOP-XXXXXXX
is taken from a different device. Now (some time has passed since I've asked this question), once I dohost 192.168.1.8
(my private IP fromifconfig en0
), I see it resolves to my computer's$HOSTNAME
, i.e. whatgethostname(3)
returns (I've checked). I believe this has therefore been resolved. I am now interested in what sets this hostname to<my username>s-MBP
("MBP" being short for "MacBook Pro"), but I suppose that's not too important.ipconfig getpacket
should show the results of whatever responded to the DHCP request setting recommended DNS and likely the source of the host name being set to what the network gear has listed for the IP address you likely were assigned.