How To'sOperating SystemsOther

How to change your Mac name using Terminal

Using this Terminal way of setting the computer name, you can easily fine tune how the computer is displayed to the network, and to Bonjour-based services that run on your network (such as Bonjour messaging). You cannot easily set these items separately in OS X’s GUI.


Screen Shot 2015-08-01 at 04.41.39


To begin doing this, open the Terminal (located in /Applications/Utilities), or SSH into the Mac that you will be changing this setting on. Next, perform the following steps:

Type in the following command, replacing “name” with a user-friendly name that will identify the computer:

scutil –set ComputerName “name”

Once you press return, this name will be set. Next, type the following command, replacing “name” with the name that you wish to display on your local network to Bonjour-based services:

scutil –set LocalHostName “name”

Finally, you can also configure and set how the computer is displayed when connecting through SSH, and the name shown inside of the Terminal by typing the following command, replacing “name” with the name you want to use to display in the Terminal and when connecting to the machine over SSH:

scutil –set HostName “name”

Note: When specifying a LocalHostName and HostName, you should not have spaces in the name. After you press return for each of the items above, you will be prompted to enter your administrator password to authenticate the changes.

After you’ve set all of these items, you can type this command into the Terminal to ensure that the proper items were set:

scutil –get HostName

If everything looks good, then you can close the Terminal and enjoy the newly set names; otherwise, rerun any of the above commands again until you set the name you desired.

Related Articles

Back to top button