2

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?

3
  • Welcome to Ask Different. macOS has multiple host names defined in the system configuration and you get to choose which is best for your needs. Yes this is normal. Is that the sum of your problem (a yes-no question) or is there something that’s “next” to solve?
    – bmike
    Commented Aug 6 at 13:30
  • I've read similar questions, but have only now realized this DESKTOP-XXXXXXX is taken from a different device. Now (some time has passed since I've asked this question), once I do host 192.168.1.8 (my private IP from ifconfig en0), I see it resolves to my computer's $HOSTNAME, i.e. what gethostname(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.
    – jnc
    Commented Aug 6 at 15:59
  • 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.
    – bmike
    Commented Aug 6 at 16:17

0

You must log in to answer this question.

Browse other questions tagged .