Change hostname in Mac OSX 10.5
Change in System Preferences/Sharing won't affect the hostname in terminal prompt.
To change it properly, use:
sudo scutil --set HostName yourname.local
login again you'll see the new hostname by typing
hostname
Written on January 20, 2013