Finder can’t create an alias inside a package or bundle

Sometimes Finder is quite eccentric, with behaviours that appear deliberate but would anywhere else be a bug. Today’s Finder quirk is that it won’t let you create an alias within a bundle. If you’ve got a few seconds to spare, I’ll show you what I mean.

Create a hierarchy of three folders inside one another, with any names you want, so they run like
one -> two -> three
with the path to the deepest of them /one/two/three.

Select each in turn, and Control-click to open the contextual menu. Listed there between Duplicate and Quick Look is the command to make an alias of that folder.

Now change the name of the top of that chain of folders to give it the extension .bundle, for instance one.bundle. Once you’ve confirmed that you do really want to change its extension, it ceases being treated like a folder, and you’ll have to Control-click to show its contents. Now select the folder immediately inside your new bundle, and Control-click. You’ll see that the Make Alias command has vanished, and trying its shortcut Command-Control-A doesn’t work either. But the third folder, nested one level deeper, can have an alias made.

I can actually make a Finder alias to that folder using my command tool alisma. With a command like
alisma -a one.bundle/two Alias2Two
you end up with a perfectly good alias named Alias2Two. So why doesn’t the Finder let you?

I turned to Apple’s reference on bundles, only to discover that what I’ve been creating here isn’t a real bundle after all, although this behaviour is present in all the different types of bundles that I’ve come across. Show the contents of an app in the Finder, select the top-level folder named Contents, and the Finder won’t make an alias from that either.

Apple defines:

  • a package as “any directory that the Finder presents to the user as if it were a single file”;
  • a bundle as “a directory with a standardized hierarchical structure that holds executable code and the resources used by that code.”

While this odd behaviour certainly applies to bundles, does it also apply to mere packages? I tested that with one of the more common forms of document package, RTFD, and the Finder’s behaviour is identical, even though the structure of a package is essentially arbitrary. While Apple’s guide to bundles and packages goes quite deep, it nowhere mentions the fact that you can’t create Finder aliases immediately inside them, let alone explains why.

I’m left to presume that, at some time in the dim and distant past, someone did something nasty with aliases inside packages or bundles, maybe an exploit. Apple’s response was to block their creation, and ever since then this behaviour has remained, even though no one now can remember why. Or can you think of a better explanation?