Change the Hostname of a machine using OS X

The scutil command in conjunction with --set HostName can be used to change the hostname of a machine that is using OS X.

$ scutil --set HostName SomeHostName.local 

You may need to restart terminal to see the updated hostname after running the command above.

more OS X posts