How to change the hostname of my Mac via Terminal?
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.
How to change the hostname of my Mac via Terminal?
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.