What side effects, if any, are there from issuing scutil –set HostName ‘Fred’

bonjourdnsNetwork

I have read that you can change all of the three "computer names" associated with a Mac using the scutil utility.

The three names in question are ComputerName (the "friendly" name), LocalHostName (used only by Bonjour) and HostName (which is subsequently returned by /bin/hostname).

I understand that there are very few side effects from setting the first two. Obviously if Bonjour clients are out there looking for the old LocalHostName then changing it will be a drag from their perspective, but otherwise this seems pretty side effect free.

I am no networking guru so the idea of changing what is reported by /bin/hostname is a bit spooky to me. Should I be concerned?

For more background, what is reported by /bin/hostname changes, it seems, currently, with the weather.

Suppose, for example, my ComputerName is Chuggid (don't ask). Suppose my LocalHostName is also Chuggid.

I've found that when I connect to some wifi hotspots, hostname returns chuggid.linksys. When I am connected to my workplace's VPN, hostname returns things like xyz-abc.vpnpool.yoyodyne.com.

So my worry stems from the fact that I'm concerned that since I didn't come up with either of these names, when I arbitrarily decide to set my HostName to chuggid that this will cause all sorts of problems.

Is it "safe" to change all three Mac "computer names" to whatever I want?

Best Answer

If you haven't already set the HostName yourself using scutil, /bin/hostname is probably reporting the result of a reverse DNS lookup on your computer's IP address. Both the IP address and the result of the reverse DNS lookup will likely differ based on the network you're connected to, and can easily change over time on the same network, too.

scutil --set HostName foo is a persistent setting, and unlike LocalHostName and ComputerName, HostName cannot be set in the GUI. For that reason, some advise against setting HostName. In my opinion, as long as you don't get confused if you try to make changes through the GUI later, setting your HostName is unlikely to cause any negative side effects for you. However, if you do run into issues, it's easy to undo with scutil --set HostName ''.

Related Question