Recently I've been using Tailscale for easily linking and managing my personal devices. I love the simplicity of it, but I got annoyed when the hostname pattern wasn't consistent across my devices.
For example, my new M1 MacBook Pro 14" was
marcs-mbp-14, but my 2 year old Intel MacBook Pro 16" was
Marcs-MacBook-Pro-16. For most people this wouldn't matter but I get a small eye twitch when everything doesn't follow a specific pattern and this was bugging me.
I tried the most obvious things like changing my computer name in sharing settings but this still didn't update Tailscale. It also didn't seem to be affecting my
$ hostname output.
After some googling I found this Stack Exchange post on how to get and set various hostname values directly. It was now clear there were multiple keys and each had different values.
Here is the command I used to make my machine name and hostname consistent.
sudo scutil --get LocalHostName # marcs-mbp-16 sudo scutil --get HostName # Marcs-MacBook-Pro-16.local sudo scutil --set HostName "$(sudo scutil --get LocalHostName).localdomain"