How to change the host name and computer name in Mac OS X
On fresh install the hostname and computer name of your Mac will be automatically set, if you wish to change it to something more memorable, use the following commads:
sudo scutil --set HostName yournewhostname
sudo scutil --set ComputerName yournewcomputername
The domain name should be specified as the fully qualified domain name such as
something.domain.com and the computer name can just be the hostname part of this.
To view the new values use the following commands:
sudo scutil --get HostName
sudo scutil --get ComputerName
A new terminal session or system restart may be needed in order for these to fully take effect.
Last updated: 20/02/2013