To set the hostname of your Mac, run the following command in Terminal: sudo scutil --set HostName my-new-hostname.local
Check it by typing: hostname