How to Change Hostname on Mac

Your Mac’s hostname is what makes it distinguishable in a local network. Let’s say for instance, your Mac along with another computer is connected to a server via a local network, then you will use your Mac’s hostname to figure out which device is your Mac, and which device is your other computer.

Now you may be wondering, what if I want to change hostname on Mac to something else? Well, if that’s the case, then you’re in luck because this blog covers a detailed guide on how to change hostname on Mac.

Let’s get started.

2 Ways to Change Hostname on Mac

Even if your Mac is not connected to a local server, you still might want to change its hostname if you bought a second-hand Mac and it has its previous owner’s name, or maybe you just want to use a unique computer name.

Well, whatever your reason may be, there are two simple methods that you can use to do the job. One relies on your Mac’s System Preferences while the other uses the Terminal.

1. Using System Preferences

MacOS comes with an app called System Preferences. It offers many customization features that you can use to tweak around with your Mac just the way you like it. From changing the appearance of your Mac, to configuring iCloud settings, you can do a lot with System Preferences. 

Similarly, here’s how you change hostname on Mac:

  • Click on the Apple icon on the top-left corner of your Mac screen.
  • A drop-down menu will appear, select System Preferences from it.
  • Once you are in the System Preferences window, double-click on the Sharing folder. If you cannot find it, then search for it using the Search box.
  • In the Sharing tab, click on the padlock icon on the bottom-left corner of the window. You’ll be asked to enter your administrator password. Enter your credentials or use Touch ID to authorize.
  • Type your Mac’s new hostname in the Computer Name field and press Return.
  • You can also click on the padlock icon again to prevent further changes.

That’s it. Now you can find your Mac over the local network with its new hostname. You may have noticed that you changed your Computer Name instead of hostname in the System Preferences. That’s because your Mac’s Computer Name serves as your hostname and there is no dedicated way to change hostname on Mac.

Related:
How to Reset Terminal on Mac

2. Using the Terminal

When it comes to making changes on your Mac, the Terminal is the most powerful tool for it. It gives you the ability to control your entire Mac from it. From changing your hostname to wiping entire drives, you can do it all.

However, we highly advise you to not go around exploring different Terminal commands at random as one wrong command can cause serious data loss. Follow along to change hostname on Mac using the Terminal.

  • Open the Finder from the Dock.
  • Head over to Applications > Utilities and launch the Terminal.
  • Once you are in the command line interface, type the command sudo scutil –set HostName YourHostName and press the Return key. For instance, we would like to change our hostname to TechanZone.example.com so we will run the command sudo scutil –set HostName TechanZone.example.com
  • If the Terminal asks for your admin password, then enter your credentials and press the Return key. When you’re typing your password, the Terminal will not show you the key presses, so don’t worry about that.

After following these steps, the hostname of your Mac will be changed. You can see the new hostname by typing the command sudo scutil –get HostName and pressing Return.

Related:
How to Enable Bonjour on Mac

How to Change Bonjour Hostname on Mac

Your Mac’s Bonjour hostname or local hostname is what identifies it to apps that use Bonjour services like:

  • iChat
  • Adobe Systems Creative Suite 3
  • iTues to find shared songs
  • iPhoto to find shared images
  • Pidgin
  • Skype
  • Vine Server

By default, your Bonjour hostname is the same as your computer name (or hostname) with .local added to it. For instance, if your computer name is TechanZone, then your default Bonjour name will be TechanZone.local. Also, if your computer name has spaces in it, then they will be replaced with hyphens by default.

If you want to set your own Bonjour hostname for your Mac, then you can do so by either using the System Preferences, or the Terminal.

1. Using System Preferences

Follow these steps:

  • Click on the Apple icon on the top-left corner of your Mac screen.
  • A drop-down menu will appear, select System Preferences from it.
  • Once you are in the System Preferences window, double-click on the Sharing folder. If you cannot find it, then search for it using the Search box.
  • In the Sharing tab, click on the padlock icon on the bottom-left corner of the window. You’ll be asked to enter your administrator password. Enter your credentials or use Touch ID to authorize.
  • Unde the Computer Name field, click on Edit.
  • Type your Mac’s new Bonjour hostname and press Return.
  • You can also click on the padlock icon again to prevent further changes.

If you use the same Bonjour hostname on multiple Macs connected to your local network, then a number will be added to their local hostnames.

2. Using the Terminal

Just like with changing the hostname, you can also change the Bonjour hostname of your Mac using the Terminal. Here’s how:

  • Open the Finder from the Dock.
  • Head over to Applications > Utilities and launch the Terminal.
  • Once you are in the command line interface, type the command sudo scutil –set LocalHostName YourLocalHostName and press the Return key. Change YourLocalHostName to whatever name you want to set as the Bonjour hostname.
  • If the Terminal asks for your admin password, then enter your credentials and press the Return key. When you’re typing your password, the Terminal will not show you the key presses, so don’t worry about that.

After following these steps, your Mac’s Bonjour hostname will be changed. You can check the new local hostname by running the command sudo scutil –get LocalHostName.

Umar Farooq
Umar Farooq
Umar Farooq is a digital Evangelist having right commands on writing, also he is a web developer. He has a BS(Computer Science) and now he is Full-Time writer of TechanZone.

Popular on TechanZone

LEAVE A REPLY

Please enter your comment!
Please enter your name here