I'm attempting to emulate how a volume is normally mounted for my NTFS volume that I've added to /private/etc/fstab. Normally, when a volume is found, like an external hard drive, it is mounted and then a shortcut to that volume is put on the Desktop and in the Finder left-hand sidebar. However, since to mount a NTFS volume as read-write in fstab, the flag nobrowse must be added, this prevents it from showing up on the desktop and in Finder's sidebar.

My research has pointed me to diskarbitrationd as the program that listens for new volumes and mounts them. I'd like to emulate the automatic adding of shortcuts to the desktop and Finder and removal on volume unmounting, and I'd like to make a script that listens for information from diskarbitationd and do the processing for me.

How would I hook into diskarbitrationd and listen for new events, then add the shortcuts to the desktop and Finder after the volume is mounted?

Thanks for your help!

1 Answer 1


You hook into diskarbitrationd by using Apple's Disk Arbitration framework. Basically you call DASessionCreate() to create a DASessionRef, and then register one or more notification callbacks.

You would need to register for the DARegisterDiskMountApprovalCallback. This gives you a notification whenever diskarbitrationd is going to mount something new. By returning a DADissenterRef from this callback, you can prevent diskarbitrationd from actually mounting the file system.

Then you can mount the file system yourself and create shortcuts etc. using standard methods, such as the mount() system call.

Here's a direct link to the page in the programming guide, you'll need to examine:


  • Thanks for sending me those links! I've been working on it for the last few hours and I've got a small application working that hooks into the Disk Arbitration. The only other question I have is, I noticed that when I add an external drive normally, it shows up on the Desktop as a Volume, not as an alias (symbolic link). Is there a way to perform this same functionality through Disk Arbitration or in Objective C?
    – josh
    Commented Jun 17, 2014 at 18:42
  • If you got it working using the links, please mark my answer as accepted :-) The easiest way to get an icon on the desktop, is simply to mount it on a new directory created in ~/Desktop/
    – jksoegaard
    Commented Jun 28, 2014 at 19:59
  • Well I mean without using an alias, since it isn't the same as a volume mounted at the desktop. Like when you insert a flash drive, it'll automatically show up on the desktop without being an alias... I know that I can do it with using an alias, but is it possible to do otherwise?
    – josh
    Commented Jun 28, 2014 at 20:07

You must log in to answer this question.

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