59

Since I upgraded to Yosemite 10.10 (14A389) my computer name keeps changing adding a (2) and (3) and so forth.

Any ideas how to fix this?

  • → guillaumevincent: please specify 1) which version of Yosemite you are running, 2) under  > System Preferences… > Network how many interfaces are green (i.e. up)? – daniel Azuelos Jan 5 '15 at 17:46
  • The discoveryd fix mentioned a few times below is what I ended up doing (I hand-edited the plist, but same effect). This doesn't stop the rogue rename requests, but it does make your computer ignore them. jherran and grgarside have the best answers so far. – Spyder Jan 6 '15 at 0:44
  • Also good insight at apple.stackexchange.com/questions/40734 – bmike Nov 22 '17 at 11:36

16 Answers 16

26

Go to Macintosh HD > Library > Preferences > SystemConfiguration and delete the following files:

  • com.apple.airport.preferences.plist
  • NetworkInterfaces.plist
  • preferences.plist

Then reboot the Mac.

The host names should be recreated correctly.

(According to http://forums.imore.com/os-x-yosemite-10-10/304804-my-computer-name-changing-10-10-a.html these are instructions provided by an Apple tech.)

  • 1
    This worked for me, although you forgot to mention the reboot. – Joshua Kolden Nov 12 '14 at 20:09
  • 1
    This isn't needed unless you don't upgrade to 10.10.1 or later... – bmike Nov 20 '14 at 19:02
  • 2
    This seems like a "cannon to kill a fly" solution. :/ – Noldorin Apr 28 '15 at 0:09
  • this will not work on El Capitan or later -- even with entering user password. The system integrity checker stops you from deleting the files. – ortonomy Aug 26 '17 at 2:02
15

To be able to achieve this, run the following commands on the terminal:

sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments: string --no-namechange" /System/Library/LaunchDaemons/com.apple.discoveryd.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

and

sudo scutil --set ComputerName <host-name-U-want>
sudo scutil --set HostName <host-name-U-want>
sudo scutil --set LocalHostName <host-name-U-want>
hostname -f
  • Hi and thanks for participating on this site. Would you mind explaining what these commands do? – Saaru Lindestøkke Dec 12 '14 at 11:50
  • I discovered this fix myself, I couldn't figure out what was causing the name changes. +1! – Spyder Jan 6 '15 at 0:39
  • 2
    Actually, it turns out that --no-namechange disables a bunch of bonjour services when discoveryd receives a name change request and discards it. Browsing to AFP file shares in finder stopped working for me until I reverted this change :( – Spyder Jan 6 '15 at 1:20
  • → Spyder: please specify 1) which version of Yosemite you are running, 2) under  > System Preferences… > Network how many interfaces are green (i.e. up)? – daniel Azuelos Jan 6 '15 at 10:06
  • 1
    This also disables Airdrop, 10.10.3 iMac – Gotschi Jun 5 '15 at 20:00
8

This solved it for me:

Go to System Preferences -> Energy Saver. Select "Power Adapter" and then uncheck "Wake for network access".

Ever since I did that a couple of days ago my computer name has stayed the same.

  • 9
    Yes, but what if I want to wake it up for network access? – Uko Nov 2 '14 at 10:40
  • 5
    Then you're screwed until the bug is fixed. – Alan Shutko Nov 8 '14 at 14:58
  • I believe @SteveEisner's answer is better. It does not break features that require "Wake for network access" (which may break Find My Mac, by the way). – Joshua Kolden Nov 12 '14 at 20:12
  • Works for me. I don't need wake-on-LAN and this is a whole lot less invasive than the other suggestion. – unixtippse Nov 15 '14 at 17:24
  • 1
    This is caused by an interaction with a daemon called discoveryd and the sleep proxies that are present within Apple TVs and Airports. Apple TVs and Airports need to be switched off before making this change, and then switched back on afterwards (as I outlined here). 9to5Mac reports that discoveryd has been dropped in OS X 10.10.4 beta and replaced with the previously ousted mDNSResponder daemon. So this problem should be fixed in OS X 10.10.4. – David May 31 '15 at 7:36
5

This is a bug in 10.10 (the initial release) and can be fixed by simply upgrading to 10.10.1 - build 14B25.

Open the App Store and apply the 10.10.1 (or later) update and you should be set once you rename any computers that adopted the (2) names.

There still are problems if you have older Apple TV, older computers where they will get renamed and rename themselves, but your computer shouldn't rename itself if it's the only device on the network.

My guess is it will take some time for this to die down and involve Airport router changes, Airport and Apple TV updates as well as iOS and Apple updates. In a household with 20 or so devices, not all can be updated to the latest.

The root cause of this is two-fold:

  1. Computers with IPv4 and IPv6 addresses literally can be contacted in two ways and bonjour/mDNS/discoveryd isn't handling this duality well yet.
  2. Computers that sleep or lose contact with the DHCP server (usually your router) can have their old address proxied or cached - which currently is handled by adding (2) or incrementing the value in (x) by one if the proxied/cached address hasn't timed out when you reconnect to the network or wake the device from sleep.
  • Comments are not for extended discussion; this conversation has been moved to chat. – bmike Apr 5 at 0:59
4
+100
  1. Open /System/Library/LaunchDaemons/com.apple.discoveryd.plist with Xcode.

  2. Add a string to the ProgramArguments array containing --no-namechange.

  3. Save and restart.

  • 1
    In my mac, this file is locked and can't be edited directly. Using PlistBuddy to modify it worked. – pupeno Apr 19 '15 at 11:12
2

The Scagg's method fixed this for me. It was only a problem when Time Machine failed to find the backup server on our network due to this annoying name change. Reverting the name back to the original in System Preferences dealt with the problem immediately. Of course I doubt if this is a permanent fix but it is an easy remedy. Many thanks Scaggs.

1

I hate to say this but I'm experiencing this as well.

One solution I found (not known if it's permanent) is by going to System Preferences in the search bar you can type 'Computer name' and select it and then change it back by erasing the (2) or (3)

  • 1
    I've tried this, but it doesn't work. A day or two later and the name is changed again. – drekka Nov 3 '14 at 4:39
  • FYI - any change of the name can help and stick things for a while. – bmike Mar 18 '15 at 14:39
1

PlistBuddy is an app to edit plist (preference) files. /usr/libexec is where it is located. The script then uses that app to edit the plist file for the computer name by adding a line that tells it not to change the name.

Personally, I'll keep removing the (2) until they fix it. While it's easy to go in and change the plist back, I will inevitably forget and at some point years down the road, it will frustrate me and take hours to diagnose... but that's just me.

  • Indeed - trying to remember that I hard coded something so often seems to cause more problems down the road than what I was trying to fix. – bmike Mar 18 '15 at 14:40
1

I don't believe that the problem is local to your computer. I started noticing this problem with the introduction of iOS 8. My AppleTv added a (n) after the name. When I upgraded my MacBook to Yosemite the same happened.

If you login to http://iCloud.com and go to Settings you'll find your iOS8 and Yosemite devices listed. I haven't found a explanation yet, but I'd recommend not using the solutions suggested so far since they may break some features. Best, John

enter image description here

1

If you have AirPort Base Station (Express, Extreme, or Time Capsule), open AirPort Utility and delete all Apple ID entries for Back to My Mac. Click Apply to restart the AirPort Re-add your Apple ID Restart again

It should fix it. The problem lies to AirPort's old settings.

  • There clearly are issues after 10.10 since I'm seeing Apple TV getting renamed and usually powering down all Airport, fixing all the host names and then starting up the network keeps things sane for a while. A huge PITA to power off all the macs and then all the iOS devices and then all the routers - so I'm trying to live with the annoyance of seeing (8) and such. – bmike Mar 18 '15 at 14:38
1

A fast solution, non invasive, and probably temporary to this is to run the following in a terminal:

sudo hostname HOSTNAME.local

That sets the hostname now. I only see this issue intermittently, and so this is a good enough solution for now. :-)

0

Give this a go, it seems to have worked for me, though it might be completely unrelated:

By default, OS X will name your computer with "[your name] 's Computer". After deleting the (2), (3), etc for the 10th time, I got annoyed with the 's and deleted it. Once I did that, the name has been stable for weeks.

My suspicion is there is some incompatibility somewhere on the network with the 's, and removing it removes the conflict.

  • That's weird, I have the same problem with the name Andromeda, which doesn't have the apostrophe. – Haroen Viaene Nov 8 '14 at 15:54
  • FYI - any change of the name can help and stick things for a while. The underlying condition doesn't need 's to cause the corruption. – bmike Mar 18 '15 at 14:39
0

I had the same issue,when I changed the computer name it would either revert back to the one Yosemite created at installation or it would generate a new one based on the "Mac Mini" naming convention. I was only able to change the name by changing the DNS lookup ipaddress for my dhcp server. As soon as I hit apply the name I set for the Mac mini was set and remained.

0

I also have the changing computer name issue. Seems to be a OS X 10.10 bug to me.

The answer from "other Rick" is rather cryptic but looks promising. Some explanation of why this works would perhaps have been useful.

Maybe it will also solve the other issue that I have - location services only work sometimes.

While dealing with a 'senior' Apple advisor today (8th Nov 2014) about my location services issue, I also asked about this issue. The advisor acknowledged it exists and thought it would be fixed in OS X 10.10.1 (currently released to developers).

0

bmike's earlier post about the duality of discoveryd led me to disable IPv6 on my wireless connection.

Now the NETBios name issue for me is fixed.

I change the name and it saves it successfully.

-1
sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments: string --no-namechange" \
         /System/Library/LaunchDaemons/com.apple.discoveryd.plist
  • doesn't really give a lot of detail. Could you flesh it out a bit for those less experience in Terminal? – Tetsujin Nov 15 '14 at 10:39

You must log in to answer this question.

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