- Hostname of your Mac:
sudo scutil –set HostName <new host name> - Bonjour hostname of your Mac:
sudo scutil –set LocalHostName <new host name> - Optional: change the computer name
sudo scutil –set ComputerName <new name> - Flush the DNS cache by typing:
dscacheutil -flushcache - Restart your Mac.