This is one for the search engines.

If you’re running Mac OS X ~v10.8 (or later), you’ve probably got a folder at the path /Users/Shared/adi. Like me, you might be wondering what it is. I did some googling and got nothing. I dug a little further and found (part of) the answer: It is used by the Mac App Store and the new iBooks app.

In case you’re interested, here are the steps I took to arrive at this answer:

  • Googled it. Didn’t get any signal.

  • I made a shell loop that checks system packages:

    $ (IFS=$'\n'
    > for pkg in `pkgutil --packages`; do
    >   pkgutil --files "$pkg" | grep --label "$pkg" -H "Users/Shared"
    > done)
    com.apple.pkg.Essentials:Users/Shared
    com.apple.pkg.Essentials:Users/Shared/.localized

    No luck there…

  • I looked in /Applications (sudo was already authenticated):

    $ sudo grep -r 'Shared/adi' /Applications 2>/dev/null
    # ...20 minutes later...
    $

    Rats.

  • Finally, I looked for sandbox entries:

    $ grep -rl 'Users/Shared/adi' /System/Library/Sandbox
    /System/Library/Sandbox/Profiles/com.apple.bookstoreagent.sb
    /System/Library/Sandbox/Profiles/com.apple.storeagent.sb

    Bingo! com.apple.bookstoreagent is obviously used by iBooks.app. But just to be extra sure:

    $ grep iBooks /System/Library/Sandbox/Profiles/com.apple.bookstoreagent.sb
       (regex #"/Library/Preferences/com\.apple\.iBooksX\.secure\.plist$")
       (regex #"^/private/var/folders/[^/]+/[^/]+/[A-Z]/com\.apple\.iBooksX"))

    And com.apple.storeagent is used by the Mac App Store:

    $ egrep -i 'app.?store' /System/Library/Sandbox/Profiles/com.apple.storeagent.sb
           (regex #"/Library/Preferences/com\.apple\.appstore\.plist$")
           (regex #"/Library/Caches/com\.apple\.storeagent/updates-com\.apple\.appstore\.updateQueue\.plist$"))
           (regex #"/Library/Application Support/App Store(/|$)")
           (regex #"/Library/Logs/appstore\.log$")
           (regex #"/Library/Preferences/com\.apple\.appstore\.plist$")
           (regex #"^/private/var/folders/[^/]+/[^/]+/[A-Z]/com\.apple\.appstore")
           (global-name "com.apple.appstore.CKSignInPrompt.hostclient")
           (global-name "com.apple.dock.appstore")
           (right-name "system.install.app-store-software")
           (right-name "system.install.app-store-software.standard-user")

Update

Thanks to a helpful anonymous commenter for pointing out that it wasn’t just 10.9 and iBooks.

I’ve been wondering about the name adi, and the possibility that it could be “Apple Distribution International”, the apple business unit responsible for electronic download sales. I’ve got no idea. That’s just wild guess that I don’t have much faith in myself.

CommerceKit

We already have a link between ADI and the Mac App Store & iBooks Store.

  1. ”/Users/Shared/adi” appears under /System/Library/Sandbox/Profiles in com.apple.storeagent.sb and com.apple.bookstoreagent.sb.

  2. storeagent and bookstoreagent appear in the apple private CommerceKit.framework

    % locate storeagent
    [...]
    /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/bookstoreagent
    /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/storeagent
    [...]
  3. CommerceKit is used by the App Store, Apple Configurator, and iBooks apps:

    % for app in /Applications{,/Utilities}/*.app/Contents/MacOS/*; do
    (otool -L "$app" | grep -i -H --label "$(basename $app)" 'CommerceKit') 2>/dev/null
    done
    App Store:  /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/CommerceKit (compatibility version 1.0.0, current version 232.0.0)
    Apple Configurator: /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/CommerceKit (compatibility version 1.0.0, current version 135.6.0)
    iBooks: /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/CommerceKit (compatibility version 1.0.0, current version 232.0.0)
  4. CommerceKit’s code contains these method references to adi

    % strings /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/CommerceKit | grep adi
    [some items omitted for bloggish reasons]
    _adiActionInResponse
    _adiSilentActionRetryCount
    %@: Saw ADI action in response to %@, set _adiActionInResponse=YES

CoreADI

You might also note that there’s a CoreADI framework:

/System/Library/PrivateFrameworks/CoreADI.framework
/System/Library/PrivateFrameworks/CoreADI.framework/CoreADI
/System/Library/PrivateFrameworks/CoreADI.framework/Resources
/System/Library/PrivateFrameworks/CoreADI.framework/Versions
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A/CoreADI
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A/Resources
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A/Resources/Info.plist
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A/Resources/version.plist
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A/_CodeSignature
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/A/_CodeSignature/CodeResources
/System/Library/PrivateFrameworks/CoreADI.framework/Versions/Current

And a receipt:

/private/var/db/receipts/com.apple.pkg.CoreADI.bom
/private/var/db/receipts/com.apple.pkg.CoreADI.plist

There is very little information in those files… even extracting text strings from the binary gives very little info. There are some references to encryption.

Its dependencies:

% otool -L /System/Library/PrivateFrameworks/CoreADI.framework/CoreADI
/System/Library/PrivateFrameworks/CoreADI.framework/CoreADI:
	/System/Library/PrivateFrameworks/CoreADI.framework/CoreADI (compatibility version 1.1.0, current version 1.34.0)
	/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 833.25.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 53.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)