Mac renames itself automatically - host name is incorrect in terminal [duplicate]

Yes you can :

sudo scutil --set HostName "YourHostName"
sudo scutil --set LocalHostName "YourLocalHostName"

to change the computer name :

sudo scutil --set ComputerName "YourComputerName"

To check if everything is okay : sudo scutil --get HostName


There is a couple ways to go about solving this problem.

The immediate change is to to open up Terminal, and issue the command

sudo scutil --set HostName {your machine name here}

The next thing to do is to

sudo pico /etc/hostconfig

Add the following line, followed by Ctrl+O, and then Ctrl+X

HOSTNAME={your machine name here}

Finally reboot