Change the hostname in Mac OSX

When I log into the network at work my Mac’s hostname always turns to:

I have my local hostname set to:

So What I would like to do is set my Mac’s hostname to my local hostname. You can do this all from Terminal in a single line.

Run this command in Terminal:

This is also helpful if you’re in Terminal and have a really long hostname at your prompt. If you want to view your current hostname, run this command in Terminal:

Update (February 13, 2012): Some people have reported that their hostname is not updating. Please try closing your current Terminal session and starting up a new one. Then type “hostname” and you should see your changes.

This is what it looked like for me:

Share on FacebookShare on Google+Email this to someoneShare on RedditShare on LinkedInShare on TumblrTweet about this on TwitterShare on StumbleUpon

Leave a Reply

Your email address will not be published.