I just transfered all of my files and settings over to a new laptop using Migration Assistant (on a mac). The name of my computer in terminal is wrong for some reason. It's unknown20c9d042dc93

The prompt looks like this

Last login: Thu Jul 19 19:46:15 on ttys001
unknown20c9d042dc93:~ Ryan$ 

How do I change the name to what it usually is, Ryan's Macbook?


The value of the $HOSTNAME variable (which is actually what you're seeing there) is determined by a reverse DNS lookup of your IP address.

Which ever DNS server your Mac is configured to use has that in its database.

You can demonstrate this with the following command:

dig +short -x $(ipconfig getifaddr en0)

Use en1 if you're on WiFi instead of wired.

  • That doesn't tell me how to fix it, I've tried restarting my router and my computer and that didn't fix anything – DontTurnAround Jul 24 '12 at 2:03
  • You need to edit the DNS zone and edit or remove that record. – bahamat Jul 24 '12 at 18:34
  • how would I do that? – DontTurnAround Jul 24 '12 at 23:16
  • If it doesn't match what's in the Sharing preference pane and you don't know where to edit the zone file then you probably don't have access to do so. Try wandering around in your router config (if you have one, if not talk to your administrator). – bahamat Jul 25 '12 at 0:14

OS X gets a name from one of several places, depending on whether you're hooked up to a network and what you have and haven't configured. One place you can set it is in the System Preferences under "Sharing" where it says "Computer name" on the top. Also, under the "Network Settings", under "Advanced", look at the "WINS" tab where it shows the "NETBIOS Name".

  • I've checked in sharing and the advanced network settings and they're both correct but the name in terminal is still wrong – DontTurnAround Jul 24 '12 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.