DEV Community

Andreas Bergström
Andreas Bergström

Posted on • Updated on

Change computer name displayed in Terminal (Mac)

As a macOS user, you may have noticed that your computer's name appears in the Terminal prompt. This name, also known as the hostname, is set by default when you first set up your computer, but it can easily be changed using a simple command in Terminal. In this blog post, we will show you how to change the computer name displayed in Terminal on macOS using the scutil command.

Step 1: Open Terminal

The first step to changing the computer name is to open the Terminal application. You can do this by searching for Terminal in Spotlight or by navigating to Applications > Utilities > Terminal.

Step 2: Determine the Current Computer Name

Once you have Terminal open, you can determine the current computer name by running the following command:

scutil --get HostName
Enter fullscreen mode Exit fullscreen mode

After running this command, your computer's name will be changed immediately, and the new name will be displayed in Terminal.

Step 3: Verify the Computer Name Change

To verify that the computer name has been changed, run the same command you used to determine the current computer name in Step 2:

scutil --get HostName
Enter fullscreen mode Exit fullscreen mode

This command will display the new computer name that you just set.

Step 4: Reboot Your Computer (Optional)

In most cases, the computer name change will take effect immediately, and there is no need to reboot your computer. However, in some cases, you may need to reboot your computer for the changes to take effect.

Changing the computer name displayed in Terminal on macOS is a quick and easy process that can be done with just a few simple commands in Terminal. By following the steps outlined in this blog post, you can easily change your computer name to something that better suits your needs. Remember to note down the current computer name before making any changes, so that you can revert to it later if needed.

Top comments (2)

Collapse
 
eliskaholwe profile image
Elis 'EMMET' Kaholwe

Okay, so where is step three ?

Collapse
 
andreasbergstrom profile image
Andreas Bergström

Step 3 was removed in an overview of the organizational structure to optimize how we do business. Just kidding, thanks for the correction!