To set host/computer name permanently or temporarily in Mac OS X , mac os provides a command line utility "scutil". This tool helps in setting the host name of your mac permanently.
Ex1:
sudo scutil --set HostName MyNewMachintoshHostname
This will set your mac host name to 'MyNewMachintoshHostname' permanently
Ex2 :
sudo scutil --set ComputerName MyNewMachintoshComputerName
This will set your mac computer name to 'MyNewMachintoshComputerName' permanently.
Ex1:
sudo scutil --set HostName
This will set your mac host name to 'MyNewMachintoshHostname' permanently
Ex2 :
sudo scutil --set ComputerName
This will set your mac computer name to 'MyNewMachintoshComputerName' permanently.