Change hostname in OS X

The hostname you initially chose for your Mac gets used in various ways; as a friendly identifier for the user, file sharing, command line networking  and services like AirDrop. Although you can change the computer name used for file sharing in the System Preferences GUI, that’s only used for file sharing. To update the hostname across the board, you need to issue the following three commands, followed by a reboot for good measure.

ComputerName is the name shown to the user in most of the GUI, and is used for things like AppleTalk and Windows file sharing.

sudo scutil --set ComputerName "my-laptop"

HostName is the name that you’ll be using at the terminal and for networking, as reported by the hostname command.

sudo scutil --set HostName "my-laptop"

LocalHostName is used for Bonjour services.

sudo scutil --set LocalHostName "my-laptop"

Remember to reboot to make sure changes take effect.

One thought on “Change hostname in OS X”

Leave a Reply

Your email address will not be published. Required fields are marked *