Mac Setup

There is no AI here. All content is human-authored and tested for accuracy.

Change Mac Hostname

How to change the hostname on your Mac using a terminal application and scutil. Explains HostName, LocalHostName, and ComputerName and the difference between them.

This article is part of a series on Mac Setup. See also: Change Mac Name for an overview of all 7 Mac names.

Setting up the hostname is one step in configuring your Mac for development. See the complete Mac setup roadmap.

Before you get started

You'll need a terminal application for hostname changes. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and worth a try.

Quick answer

Your Mac has three names you can set with the scutil command. Open a terminal application and use these commands, replacing "the-name" with your desired name:

$ scutil --set HostName "the-name"
$ scutil --set LocalHostName "the-name"
$ scutil --set ComputerName "the-name"

Each command requires your password. Read on to understand the difference between them and when to set each one.

The three names explained

Your Mac has three distinct names that serve different purposes:

ComputerName

The ComputerName is the "friendly" name that appears in System Settings, AirDrop, Bluetooth, and Find My. You can set it via the GUI or the command line. For full details, see Change Mac Computer Name.

LocalHostName

The LocalHostName is the Bonjour/mDNS name. It is used for .local network addresses (for example, the-name.local). It appears in your terminal prompt by default. The LocalHostName is auto-derived from the ComputerName but can be set independently.

HostName

The HostName is the DNS hostname. It is used for network connections and SSH. The HostName is not set by default on a new Mac. When unset, macOS falls back to the LocalHostName.

When to set each one

Choosing the right name depends on what you are trying to do:

  • Just got a new Mac and want to change its name? Change the ComputerName (which auto-updates the LocalHostName). See Change Mac Computer Name.
  • Want to change your terminal prompt name? Change the LocalHostName.
  • Setting up SSH or need a specific network hostname? Set the HostName.

Check current values

You can check the current value of each name with these commands:

$ scutil --get ComputerName
$ scutil --get LocalHostName
$ scutil --get HostName

Note: scutil --get HostName will return "HostName: not set" on a fresh Mac. This is normal. When HostName is not set, macOS uses the LocalHostName as a fallback.

Change each value

Set the ComputerName

$ scutil --set ComputerName "the-name"

The change takes effect immediately in System Settings and network services.

Set the LocalHostName

$ scutil --set LocalHostName "the-name"

You will see the new name in the terminal prompt after you open a new terminal window. The LocalHostName must contain only letters, numbers, and hyphens (no spaces).

Set the HostName

$ scutil --set HostName "the-name"

The change takes effect immediately for new network connections. Use this when you need a specific hostname for SSH access or DNS configuration.

Related guides

Continue setting up your Mac

Don't miss the full visual roadmap and checklist that shows how to set up a Mac for software development, with all the essential tools and settings you might not yet know about.