But then you go to Terminal.app and realized that your prompt still has the old name :(. That is because the default terminal prompt uses the hostname. Doing above things does not change the hostname.
You could change the prompt by modifying
$PS1variable but that will not solve the problem as the kernel hostname would still have the old name.
Change the HostnameTo change it we use
$ hostname Ignacio-no-MacBook-Pro.local $ sudo sysctl kern.hostname=IgnacioMBP kern.hostname: Ignacio-no-MacBook-Pro.local -> IgnacioMBP $ hostname Ignacio-MBP.localTo confirm current value we use
hostnamecommand. Now we have to restart the terminal so the new hostname is read again populating
$PS1as intended :)
MDLog:/sysadmin - How to change the hostname of a Linux system