Home » Questions » Computers [ Ask a new question ]

Where does Mac OS X store file association information?

Where does Mac OS X store file association information?

I know there is a system preferences pane to manually modify the file associations in Mac OS X Leopard. However, I'm curious where does Leopard actually store these information?

Asked by: Guest | Views: 74
Total answers/comments: 2
Guest [Entry]

"Sorry, this question is old, but the answer is really wrong.

As toolbear mentioned, Doug Harris' answer is only partially correct.

The Launch Services Database file, which is where all of the information for all known applications and the types of documents they can handle is stored, is located in the following location:

Lion:

/private/var/folders/**/**/-Caches-/com.apple.LaunchServices-034501.csstore

Snow Leopard:

/private/var/folders/**/**/-Caches-/com.apple.LaunchServices-025501.csstore

Leopard:

/Library/Caches/com.apple.LaunchServices-023501.csstore

The /private/var/folders/ folder is where the ""secure"" Caches and Temporary folders for each user are stored. The **'s in the path shown above will be something like /dl/dlXWtS5WH9SNboPxxrDIyE+++TI/, or another obscure character sequence to prevent guessing.

Note that the name com.apple.LaunchServices-025501.csstore is composed of the user ID (mine is 501) appended to the -025 suffix, which is unique to Snow Leopard. (In each version of OS X, Apple tends to change the distinguishing suffix used to prevent compatibility problems between different versions of OS X. You'll notice that Leopard used -023). Lion is using the -034 suffix."
Guest [Entry]

"@Doug Harris' answer is only partially correct. The defaults system stores your local additions or overrides to the file associations. However, OS X comes with some default, system wide associations.

If you run lsregister -dump you'll see what Launch Services calls CoreTypes and the associations provided by applications it finds.

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -dump

I haven't exhaustively scanned the output. There may be others sources indicated in that dump, but a large number of these types come from /System/Library/CoreServices/CoreTypes.bundle. There may be a plaintext or plist file in there where the types are enumerated. The associations I believe come from scanning the contents of *.app in known application locations. Here's where Launch Services understands TextWrangler is an editor to numerous file types:

--------------------------------------------------------------------------------
bundle id: 10928
path: /Applications/TextWrangler.app
name: TextWrangler
identifier: com.barebones.textwrangler (0x8000008d)
...
library items:
--------------------------------------------------------
claim id: 20216
name: TextWrangler text document
rank: Default
roles: Editor
flags: relative-icon-path
icon: Contents/Resources/TextWranglerTextDoc.icns
bindings: .a, .asm, .asp, .bashrc, .c, .c++, .cc, .cfm, .conf, .cp, .cpp, .cshrc, .css, .cxx, .equ, .f, .f77, .for, .ftn, .h, .h++, .hpp, .htm, .html, .inc, .j, .java, .js, .jsp, .log, .m, .mm, .p, .pas, .pch, .pch++, .php, .php3, .pl, .plist, .plx, .pm, .ppu, .r, .rb, .rez, .rhtml, .rss, .s, .sql, .shtm, .shtml, .tcl, .tcshrc, .text, .txt, .wml, .xhtml, .xml, .xsl, .xslt, .yaml, 'TEXT'
..."