My Mac's hostname keeps adding a "-2" to the end 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?
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