Change Computer Name on macOS When It Seems Stuck On Old One

This is the only thing that worked when I saw that my old work computer name was showing in the prompt of my new work computer! Crazy.

sudo -i
Password:
 
for n in HostName ComputerName LocalHostName; do
    scutil --set $n <MYNEWHOSTNAMEHERE>
done
 
exit
Updated Last:2023-01-05T22:32:04.000Z