OS X Computer Name Is Not The Host Name
Setting the hostname separately with scutil
If you configure the OS X computer name in System Preferences, Sharing, Computer Name, but it’s not reflected by /bin/hostname, then execute sudo scutil --set HostName MYHOSTNAME and restart.