Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

For three days straight, I have connected to the public WiFi network at my local library. Each day, I have seen a different prompt in Terminal. Here are some of the prompts I've seen:

zp-pc:~ russell$
mary-pc:~ russell$
normob05:~ russell$

I have check under System Preferences -> Sharing, and my computer name is "Russell's Mac". Also, I set the DHCP Client ID to "RUSSMAC" under System Preferences -> Network -> Advanced -> TCP/IP, but I still see the random host names at the Terminal prompt.

Why is my computer name changing every day?

share|improve this question

3 Answers 3

Type in Terminal:

scutil --get HostName

If there's no HostName available, what you see is probably coming from the DNS or DHCP server.

Set your HostName with:

sudo scutil --set HostName 'yourHostName'

That should do it.

share|improve this answer
    
just make sure it matches what you set your "Sharing -> computer name -> "Computer on the network can access your computer at" else it can cause some reverse lookups to fail. Or do andrewhml's answer instead which doesn't have this problem. –  rogerdpack Dec 12 at 20:27
up vote 5 down vote accepted

Found the answer here, though there is some discussion about the details.

In short, the Mac will pick up a host name from the DHCP server. This does not affect your computer's name as you have assigned it. This will only affect what you see at the command prompt.

share|improve this answer
    
I think the link is dead, care to give us a summary of what the answer once was there? –  rogerdpack Dec 12 at 18:43
    
It's a short discussion of this exact issue. The conclusion is that you're seeing a name that was given to you by the computer that assigned you an ip address. In other words, the library's wifi gave me a random name that it picked up from some other computer that previously connected to their wifi. –  Russell Thackston Dec 14 at 1:58
    
what was the "answer" mentioned then? Just that it's benign to go ahead and ignore? –  rogerdpack Dec 14 at 7:02
    
Correct. BTW, the link is working now. It looks like klanomath fixed it. –  Russell Thackston yesterday

This is very late, but hopefully this helps those in the future who run into this problem. After a lot of research the somewhat long but most simple answer I found was to:

  1. Open System Preferences > Network
  2. Click the location dropdown menu
  3. Select "Edit Locations..."
  4. Click the plus button to add a new location
  5. Add a new location by giving it a name
  6. Click Done
  7. Click Apply (instructing it to use the new location)
  8. Open new Terminal window

That should do it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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