11

If my Mac's computer name (in the Sharing prefs) is "Node" normally, once in a while when using the Terminal, I can see it's magically changed itself:

Node-2:~ $

For some reason it thinks its own name is taken and adds "-2" to the end. I have to go into the Sharings prefs and change it back. Why would this be happening and how do I stop it?

8

This is a known bug with the discoveryd process on 10.10 Yosemite. Recent rumors is that it will be replaced by its predecessor, mDNSresponder, come 10.10.4 to help alleviate network issues. Although the actual cause is unknown, it has been said that it is related (at least in part) to improper name resolution in DNS when the computer wakes from sleep. It sees itself as a duplicate on the network, and as such it appends the suffix to the title.

While there are some "fixes" YMMV - It's probably best to just keep renaming it the way you do, and then wait for the next release of OSX to come out and fix it so you don't sacrifice any functionality like Wake on LAN.

Source

  • It's not a rumor. discoveryd is gone in 10.10.4, replaced with mDNSResponder. – William T Froggard May 29 '15 at 23:06
  • 3
    @Froggard true, although that's only in the beta. I say rumor since it's not real until it ships - could always be retracted last minute due to some sort of issue. – smoooosher May 29 '15 at 23:26
  • I agree with @smoooosher, mDNSResponder only came back in the most recent 10.10.4 beta, so it's possible (although unlikely) that discoveryd will come back. – Alan Shutko May 30 '15 at 14:49
8

That rename comes from any one other device on the network that remembered the IP address of your mac before it went to sleep or renewed its DHCP lease.

You would want to power down all Apple TV and Apple airport/time capsule devices and then restart your router (if an Airport device isn't doing the routing) at that point, the iOS and Mac devices should let you rename things again slightly more permanently than if you feel like you're battling an automatic useless machine.

It's a pain, and Apple had what it thought was a fix in 10.10.2 and 10.10.3 - we'll see if more patches help...

See:

5

As other answers mention, this is a bug in Yosemite and will hopefully be gone when 10.10.4 releases. Until then, I have the following Keyboard Maestro action set up, which will automatically reset the system name whenever the system wakes up.

Mount Diskstation

Triggered by any of the following:

At System Wake

Will execute the following actions:

Shell Script

COMPUTER_NAME=Zephyr
sudo scutil --set ComputerName $COMPUTER_NAME
sudo scutil --set HostName $COMPUTER_NAME
sudo scutil --set LocalHostName $COMPUTER_NAME
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME

Display results in a window.

I also have the following in /etc/sudoers:

ats     ALL=(ALL) NOPASSWD: /usr/sbin/scutil --set ComputerName Zephyr, /usr/sbin/scutil --set LocalHostName Zephyr, /usr/sbin/scutil --set HostName Zephyr, /usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string Zephyr
  • now this is awesome! Way to go with a concrete solution instead of hand waving. – bmike May 30 '15 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .