4

When I open a file info, and change the application responsible for that file, where is this override stored on the system?

2 Answers 2

4

The data is stored in the resource fork of the file, which is stored as the extended attribute com.apple.ResourceFork.

Take the following as an example -

Using Terminal, create a test file, calling it "test.txt"

System:~ user$ touch test.txt

By default "txt" extension files are opened with TextEdit. (Unless you've modified the system-wide default.) In the Finder, change the association to something else. Go back to the Terminal ..

 System:~ user$ ls -l@ test.txt

 -rw-r--r--@ 1 user  staff  0 Sep 29 11:21 test.txt
         com.apple.ResourceFork 1338

The @ symbol denotes the file has extended attributes, and ls -l@ lists the attributes as part of the long format.

If you have the Developer Tools installed, you can use DeRez to inspect the resource fork, and you'll see the path of the application you selected in the fork.

It's archaic, deprecated, and could (rightly) be called a hack ... but given that the UTI and bundle identifier system is "incomplete", it's what Apple uses.

3
  • Where's @ documented? Current (10.7.4) OS X Darwin ls supports the following options. ls -ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1
    – ocodo
    Jul 3, 2012 at 2:15
  • @slomojo - According to Apple's online man page for ls for 10.7.4, @ is still accepted.
    – JasKerr
    Jul 5, 2012 at 14:41
  • Thanks, seem they just overlooked it on the quick opt list, and I happened to try it out on a folder containing only files that didn't have res-forks. - It's working (no surprise) in ML 10.8 too.
    – ocodo
    Jul 5, 2012 at 15:57
0

I'm not sure about Mac OS X, but Mac OS (i.e. Classic) used to store this in the resource fork of each file with two pieces of information: the type code and the creator code. Both were four-byte sequences and were thus usually rendered as four character strings. The type code identified the type of the file (e.g. TEXT for a text file, APPL for an application), while the creator code identifies the application that created the file (e.g. ttxt for SimpleText or MSWD for Microsoft Word). Thus a file created by SimpleText would open in SimpleText by default, while still being identified as a text file and therefore compatible with Microsoft Word, should you choose to manually open it with Word.

Snow Leopard no longer pays any attention to type and creator codes, having replaced them with UTIs, which are reminiscent of MIME types, although more flexible, and can be used to specify the default program as well as determining which programs are compatible with a given file, but I'm not sure how individual overrides are done.

1
  • 1
    Changes are stored in ~/Library/Preferences/com.apple.LaunchServices.plist Mac OS X also stores more information in /Library/Preferences/.GlobalPreferences.plist & ~/Library/Preferences/.GlobalPreferences.plist & ~/Library/Preferences/ByHost/.GlobalPreferences.plist However, I was unable to locate where the global overrides are stored.
    – Madison S
    Sep 29, 2010 at 15:07

You must log in to answer this question.

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