Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On Mac OS X, I have two aliases in my Applications folder, each points to another folder. They are 1 MB each. Why so large?

I've found other sources on the Internet to say that yes, alias files can be large, but no explanation why. Even if they store a lot of redundant information to find the target file in case it moves, I can't imagine why an entire megabyte would be needed.

share|improve this question
    
For updates: apple.stackexchange.com/questions/81671/… –  Cawas Mar 11 at 12:33

1 Answer 1

up vote 3 down vote accepted

First of all, I wonder if the 1 MB is correct: true, Finder's Show Info tells you this, but in Terminal the file sizes are always just half of that. Odd.

The size is due to embedded icons. Note that an alias to an application (more precisely: an application bundle) might be much smaller than an alias to a plain folder. Hence, I guess plain folders use a higher definition icon than, for example, iTunes does. And indeed, if you change the icon of the source, the icon of the alias is not changed.

In Terminal you'll see:

ls -l@

drwxr-xr-x   2 arjan     staff       68 Nov 14 09:20 MyFolder
-rw-r--r--@  1 arjan     staff   519012 Nov 14 09:20 MyFolder alias
    com.apple.FinderInfo         32 
    com.apple.ResourceFork   518659 

drwxr-xr-x   2 arjan     staff       68 Nov 14 09:26 MyOtherFolder
-rw-r--r--@  1 arjan     staff   519040 Nov 14 09:26 MyOtherFolder alias
    com.apple.FinderInfo         32 
    com.apple.ResourceFork   518679 

So: 4 bytes more in the "Resource Fork" for each letter in the file name, and on the file system things are padded a bit. That same Resource Fork also includes the icons. If you have the Apple Developer Tools installed:

DeRez "MyFolder alias" > MyFolderAlias.txt

That text file then shows you more than 32,000 lines of text that represents the icon.

(See also Ars Technica about HFS+. Without the Developer Tools, your can use xattr -l to kind of see what's in those extended attributes.)

share|improve this answer
    
I'm pretty sure the Get Info file size is correct; it's the total of data and resource fork. I guess the icon data is stored in both forks. –  benzado Nov 14 '10 at 9:47
    
@benzado, after reading Ars Technica, I thought Resource Forks were now only embedded in the extended attributes (which, if I understand correctly, are actually in the Data Fork?) –  Arjan Nov 14 '10 at 9:49
    
Data fork, resource fork, and extended attributes are all separate. –  benzado Nov 14 '10 at 9:51
1  
For "My Folder alias" I get "1 MB on disk (1,037,671 bytes)", while 519,012 + 32 + 518,659 = 1,037,703. Hmmm. 519,012 + 518,659 = 1,037, 671 indeed. –  Arjan Nov 14 '10 at 9:54
1  
Although resource forks usually have a standard format (defined by the Mac OS Resource Manager), an app can use the resource fork to store information in any format it chooses. So the OS can't use resource fork to store extended attributes, since it couldn't guarantee they wouldn't clobber some app-specific data. Glad we can help each other! –  benzado Nov 14 '10 at 11:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.