9

Mac OS X Finder is smug enough to display any non-Mac device as a picture of a PC with a BSOD, but I'm wondering if it's possible to add other devices, so my Ubuntu machine is detected and has a picture of a Ubuntu PC, and my Windows PCs has a picture of Windows crashing, etc.

I know that public.generic-pc.icns exists and can be replaced but I'm not interested in replacing it per se, more interested in getting finder to recognise other devices (or learn how it recognises other Apple devices) and map custom icons to them.

Any clue?

3
  • There needs to be a way to distinguish between the machines, and I don't think samba will purposely behave different from windows to be recognised as such...
    – Daniel Beck
    Dec 5, 2011 at 7:03
  • 1
    According to this, you can advertise a server as an Xserve or other device. Looking in CoreType.bundle, I can see that there is a mapping of these names (for example Xserve or RackMac is mapped to com.apple.xserve (.icns) by using the com.apple.device-model-code Equivalent Types. Extending from this, I'd assume that creating a custom one would be adding another entry, but I can't get it to work.
    – Adam M-W
    Dec 12, 2011 at 8:21
  • I'd argue this belongs to SO because I don't believe there's any tweak that would allow that without any heavy programming. But then again, I'm just guessing here in hope to shed a light. :P
    – cregox
    Jan 10, 2012 at 12:27

3 Answers 3

9

Seems that I was very close, I just wasn't getting my machine to advertise itself properly.

I finally got it to work:

Custom Network Device Image in Mac OS X

The method I used is below:

  1. First, on the Mac, I created a custom bundle which I called "ComputerTypes" by copying and pasting an existing bundle such as MobileDevices.bundle or MachineTypes.bundle in the /System/Library/CoreServices/CoreTypes.bundle/Contents/Library folder.

  2. I then opened Contents/Info.plist with XCode Plist Editor and edited all the details to create a custom bundle, changing the Bundle Identifier, Name, etc.

  3. I removed all the existing entries in the "UTExportedTypeDeclarations" key then created a new entry per device. Each device entry has a "UTTypeConformsTo", "UTTypeDescription", "UTTypeIconFile", "UTTypeIdentifier" and "UTTagSpecification", where the "UTTagSpecification" dictorinary contains an Array in the key "com.apple.device-model-code" with all of the mDNS _device-info._tcp identifiers to accept. UTTypeIconFile refers to a icns file in the Resources folder.

  4. I then saved the bundle to /System/Library/CoreServices/CoreTypes.bundle/Contents/Library folder and rebooted.

  5. On the other machine, I needed to set up to advertise a _smb._tcp service as well as the _device-info._tcp TXT record, as usual except using a custom model name rather than a Mac product name.

  6. After rebooting the Mac, it should appear like the picture above.

I uploaded the finished bundle to http://dl.dropbox.com/u/4140005/ComputerTypes.bundle.zip as an example.

3
  • 1
    Very nice. How'd you accomplish step 5? Samba configuration?
    – Daniel Beck
    Mar 10, 2012 at 8:54
  • 1
    Step 5 is just about setting avahi-daemon to advertise a _smb._tcp service and a _device-info._tcp txt record. The howto linked above if you scroll down to step 5 should help, except change _afpovertcp to _smb and change to port 445, and change the model to your custom value.
    – Adam M-W
    Mar 11, 2012 at 0:47
  • Has anyone gotten this to work on a windows machine? Is there even a Bonjour implementation on Windows that can do the advertisement?
    – John O
    Jan 21, 2013 at 8:16
1

This is probably only worthy of being a comment to Adam's answer, but I need formatting.

In Windows, assuming iTunes or Bonjour for Windows is installed, you can advertise a samba share with the following:

  1. Open two cmd prompts.
  2. Run the following commands (in different consoles):

    dns-sd -R ComputerName _device-info._tcp local 445 model=Xserve3,1

    dns-sd -R ComputerName _smb._tcp local 445

Dns-sd won't exit, and if you Ctrl-C or close cmd, the share will disappear from Finder. I can only manage to use the default OSX icons, despite Adam's helpful sample file (it might be a 10.6 vs. 10.8 issue... there are plist differences between his and 10.8's). Also, I'm having a heck of a time figuring out how to get windows to run this command and shut it down at poweron/poweroff and wake/sleep (though, to shut down dns-sd from a bat script you'd just use taskkill).

1
  • could you just run the batch as a service? Mar 21, 2013 at 0:53
0

I can't comment because of rep but I would like to add to this because people now might come across it and want to pull this off. With Sierra's SIP implementation, Adam's method no longer works by default due to the inability to copy files to any CoreServices subdirectories. You would have to disable SIP first.

Before I go further you must understand that SIP is a protective measure put in place by Apple to make sure the integrity of your system is not compromised.

I will not go into how I feel about SIP as an application developer but suffice it to say that I'm not always in sync with Apple's decision making.

To do this:

Reboot your Mac. When you hear the chime, press and hold CMD+R until you see the desktop start to appear. From the 'Utilities' menu on the top, select 'Terminal' Type "csrutil disable" and hit enter. Type "reboot" and hit enter.

SIP is now disabled. I generally don't care for SIP myself but understand I'm in the minority. Also, I don't want Apple too mad at me. That said, I recommend if you are doing this to replace a system icon that you reenable SIP immediately when you are done. To do so, follow the instructions to disable but replace the word "disable" with "enable".

2
  • 1
    Don't forget the question was asked 5 years ago and the comments are old also, at that time it was fine
    – yass
    Mar 22, 2017 at 19:01
  • …and another 5 years later, even disabling SIP won't let you change anything on the boot drive. It's now encrypted & hashed.
    – Tetsujin
    Mar 12, 2022 at 7:21

You must log in to answer this question.

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