DEV Community

Andreas Bergström
Andreas Bergström

Posted on • Edited on

5

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

Step 3: Change the hostname

scutil --set HostName My-New-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 4: 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 5: 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.

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (4)

Collapse
 
deddiekoel profile image
Coert van den Thillart

The actual step that makes the change is missing:

scutil --set HostName My-New-HostName

Collapse
 
andreasbergstrom profile image
Andreas Bergström

Wow, somehow I removed that part... Thanks!

Collapse
 
eliskaholwe profile image
Elis Kaholwe

Okay, so where is step three ?

Collapse
 
andreasbergstrom profile image
Andreas Bergström • Edited

Removed by misstake, should be back now

Image of Stellar post

How a Hackathon Win Led to My Startup Getting Funded

In this episode, you'll see:

  • The hackathon wins that sparked the journey.
  • The moment José and Joseph decided to go all-in.
  • Building a working prototype on Stellar.
  • Using the PassKeys feature of Soroban.
  • Getting funded via the Stellar Community Fund.

Watch the video 🎥

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay