"Named forks" is something Apple was planning to implement but (as far as I can tell) never actually did. (Or at least not in OS X – I'm unsure about Classic MacOS 8/9). macOS contains various historical remnants of that earlier plan (such as the /..namedfork/rsrc
syntax, the ATTR_FILE_FORKLIST
file attribute supported by the getattrlist
API, etc). Eventually, Apple decided to implement extended attributes instead (in MacOS X 10.4 Tiger).
Among filesystem designers, there is a philosophical dispute about how best to support arbitrary custom metadata – "named forks" and "extended attributes" represent those two different approaches. Microsoft Windows is a rather unusual example of a system which implements both – it calls named forks "alternate data streams" (or just "streams" for short).
The key difference is what the API to manipulate this metadata looks like:
- named forks/streams: these are essentially hidden "sub-files" which can be attached to a file, and which a programmer can read/write using the same APIs as ordinary data files. One may need to invoke some special API to list them, but you can open them just like a normal file (often using some special syntax: Apple was planning on
/..namedfork/
, Windows just uses a :
to separate the file name from fork/stream name). They have the same size limits as ordinary files–you can have a 1KB data file with a 1GB named fork/stream attached.
- extended attributes: each file has named key-value pairs, and has a "get attribute"/"set attribute" API to access them. You cannot open/read/write these named attributes using the same API calls you use for ordinary files. The file APIs do not accept any special path syntax to refer to them. There is usually a limit on their size, much smaller than that for ordinary data files (kilobytes or megabytes rather than gigabytes)
(As an aside, Solaris unfortunately confuses things by adopting essentially the first approach but calling it "extended attributes" – and the NFSv4 protocol inherited that terminology from Solaris.)
My educated guess is that Apple was internally trying to make up its mind between those two options, and originally was aiming at the first, but before they'd actually shipped the first option, changed their mind to the second, and the second is what actually ended up shipping.
Apple reused some of the filesystem data structures in HFS Plus originally intended to support "named forks" to implement "extended attributes". Given that fact, and given that "extended attributes" is the replacement for "named forks", you will occasionally find people treating the two terms as synonyms, making statements such as "ls -@
lists named forks". While I understand the reasons for doing that, I think it causes confusion, because the vestigial APIs in macOS which were intended to support named forks don't work for extended attributes.