Updating Hostname (in terminal/bash)

I’ve been configuring my computer a bit, including setting up my .bash_profile file, and some bash aliases.

After setting up a custom bash prompt (I used a typical configuration):
export PS1="\u@\h[\w]$ "
I noticed that my bash prompt looked like this: ‘will@unknown-0064ee1608a0[~]$’ – pretty lame, why does it say unknown?

After doing some searching I found out that my host name needed setting (or updating?).

The command to do that is:
scutil --set HostName YOURHOSTNAME (I found that info here: http://osxdaily.com/2010/09/06/change-your-mac-hostname-via-terminal/ – thanks!)

YOURHOSTNAME would of course be replaced with whatever you want, and it doesn’t have to be all caps.

Now it looks like this: ‘will@1405[~]$’ – still pretty lame, I know, but it’s relevant (to me – I swear!) and better than unknown…

scutil, as it turns out, is a utility that let’s you manage system configuration parameters. I’m not sure whether or not it will come in handy in the future, but so far it has helped me solve one small thing!

2 thoughts on “Updating Hostname (in terminal/bash)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>