Posted on 10/04/2007. By Pete Otaqui.
My mac terminal came with a default prompt which looked like this:
I had changed my computer name to something I preferred, which works fine for browsing to your own apache server, but this did not have any effect on thebash prompt. I also wasn’t (yet) interested in customising the prompt with a bashrc file as suggested all over the web.
It turned out that the terminal was showing the hostname of the machine, not the computer name. You can set the hostname with the following snippet:
$ sudo hostname whatever-you-want
This would give you a prompt like this:
UPDATE: the above method does not permanently change the hostname. It will revert once you reboot. I’ve tried another method which seems better:
$ sudo scutil --set HostName whatever-you-want.example.com