File system funnies in Sierra: folders that aren’t, and altered aliases

The Finder is an elaborate illusion, and Sierra’s Finder plays even more tricks on you. If you don’t believe me, try a simple test. Open the Library folder in your Home folder (~/Library) in the Finder. Look at the folder named Mobile Documents, which looks like an ordinary folder. Now select it.


Where are its contents? So, maybe you don’t have permission to see inside it. Check that using the File / Get Info (Command-I) command.


Where are its permissions?

So the Finder doesn’t want you to look inside whatever that folder is. Now use the Go / Go to Folder menu command and type ~/Library/Mobile Documents into its text box. Where does that take you? Not into said folder, but straight up to the root level of iCloud Drive.

If you’d like to become even more bewildered, open Terminal, and ensure that you are at the root level of your Home folder (~). Then type
ls -laO Library
and you’ll see that the folder named Mobile Documents is owned by you, with read and write privileges:
drwxr-xr-x@ 74 hoakley staff - 2516 5 Oct 17:16 Mobile Documents

Furthermore, in Terminal you can list its contents
ls -laO /Library/Mobile Documents
although here you’ll notice that the second-listed item, with the standard Unix name ‘..‘, says it’s hidden. This doesn’t hide the folder, nor deny you access, but is used by the Finder to stop you from listing the contents of that folder. Although there’s nothing to say that it is an alias, as far as the Finder is concerned, any attempt to open the folder will immediately take you to what it interprets that folder to be, your iCloud Drive.

If in Terminal you list the Mobile Documents folder, you’ll probably come across a folder with a name like com~apple~Pages there. List it in Terminal, and you’ll see something like
total 16
drwxr-xr-x 9 hoakley staff - 306 22 Dec 2015 .
drwxr-xr-x@ 74 hoakley staff - 2516 5 Oct 17:16 ..
-rw-r--r--@ 1 hoakley staff - 6148 4 Dec 17:50 .DS_Store
-rw-r--r--@ 1 hoakley staff - 0 23 Jul 2014 .ginger
-rw-r--r-- 1 hoakley staff - 0 26 Dec 2012 .sage_U10
-rw-r--r-- 1 hoakley staff - 0 25 Dec 2013 .tangier_M3
-rw-r--r-- 1 hoakley staff - 0 25 Dec 2013 .v1
-rw-r--r-- 1 hoakley staff - 0 25 Dec 2013 .v2
drwxr-xr-x 9 hoakley staff - 306 10 May 2016 Documents

Go back the Finder now, and open the Go / Go to Folder dialog, and enter that folder path, say ~/Library/Mobile Documents/com~apple~Pages.


At first, the letters which you typed will appear, for a few moments. Finder will then transform them into their equivalent iCloud Drive path, and go there instead. Or, to be precise, it will go to that folder in your iCloud Drive, and still not show you the inside of the ~/Library/Mobile Documents folder.


~/Library/Mobile Documents contains four types of folder:

  • those with names like 3N3RG282KZ~com~indeeo~iDraw, which contain files saved by (?sandboxed) iOS and macOS apps with iCloud Drive support,
  • those with names like com~apple~Pages for the app-specific folders which you normally see in iCloud Drive,
  • those with names like iCloud~com~apple~iBooks for files saved by other iOS and macOS apps to iCloud,
  • com~apple~CloudDocs, which holds any folders on your iCloud Drive which you have created yourself, and is where docs moved for Optimized Storage will end up too.

Sierra has also changed the Mac Extended File System’s implementation of aliases (Finder aliases, not Unix hard or symbolic links, which I believe are unchanged). Prior to Sierra, each alias required a file of just under 1.3 MB in size, to contain the alias information:
-rw-r--r--@ 1 hoakley staff - 1268984 24 Jan 2016 narrative alias

Sierra’s new aliases are much more efficient in their use of space, now requiring less than 1 KB to achieve the same thing:
-rw-r--r--@ 1 hoakley staff - 976 4 Dec 21:17 moreau alias

There are some snags with this, though. First, old aliases have not been converted to the new style, so they still work the old way and take up 1.3 MB each. If you want to change an old alias to new style, you’ll have to trash the old alias and make a new one. Next, some older software doesn’t work properly with the new aliases (indeed, some doesn’t work properly with old ones now, either). And the one app which keeps on struggling with old and new style aliases is, of course, Apple’s Finder.

Because in the Unix file system, as shown in the Terminal excerpts, aliases are actually documents, Sierra’s Finder (10.12 and 10.12.1) keeps thinking that they’re documents, not aliases. But eventually, I’m sure that one of Apple’s engineers will get around to fixing that for us.

If you want to brush up your understanding of aliases and links, this article should make them crystal clear.