Create a Named Fork and Store Data on macOS – How to

filesystemhfs+macos

It says here…

https://en.wikipedia.org/wiki/Fork_(file_system)#Apple

…that the HFS+ file system in OSX supports "multiple named forks". How do I create a named fork at command line, and then how do I store data in it? Also, what are the maximum number of bytes I can place in my named fork?

Best Answer

Extended attributes is what you're looking for. xattr will allow you to view and modify extended attributes at the command line. Look at the man page for more details, but in brief you can write one with the following command

xattr -w com.foo.myattribute "A bunch of data" /path/to/file