How to change the hostname of my Mac via Terminal?

Asked By 0 points N/A Posted on -
qa-featured

How to change the hostname of my Mac through Terminal? I don't know how to do.

Please help.

SHARE
Best Answer by cathy emrald
Answered By 5 points N/A #162125

How to change the hostname of my Mac via Terminal?

qa-featured

Follow these instructions:

scutil –set HostName new_hostname

1. Just replace new_hostname with your desired hostname. I have changed my Mac’s hostname to MacBookPro.

scutil –set HostName MacBookPro

2. Then, you will be asked for your admin password since you’re using the sudo command. After the command is executed, you can verify that the changes took place by typing:

hostname

3. You can also set a temporary hostname change by using the following command:

sudo hostname new_hostname

This will reset itself after your Mac reboots though, so if you want a permanent hostname change, use the above command instead.

Hope this will help.

Best Answer
Best Answer
Answered By 5 points N/A #162126

How to change the hostname of my Mac via Terminal?

qa-featured

You can change your Mac computer name through Sharing system preference or through terminal. Here's the steps on how to do it via terminal.

Just use this Sudo command:

scutil –set HostName new_hostname

Just simply change value for the new_hostname with your preferred username. And also, you can set a temporary hostname by using the command:

sudo hostname new_hostname

When you reboot your Mac, it will reset automatically. Use the commands above if you want a permanent hostname change.

Related Questions