When it comes to aliases and links, macOS has an embarrassment of riches: symbolic links (symlinks), hard links, and Finder Aliases (including Bookmarks). If you work exclusively in the Finder and GUI, you only have ready access to the last of those. When working in Terminal’s command line, the first two are readily used, but there has been no way of making or resolving Finder Aliases there. That’s worse than inconvenient.
alisma is a very simple command tool which opens up access to Finder Aliases in commands and scripts.
To create a Finder Alias to an item, use
alisma -a sourcefile aliasfile
which makes the Finder Alias at the path aliasfile, pointing to the item at the path sourcefile.
To resolve a Finder Alias, including those made in the GUI and by alisma, use
alisma -p aliasfile
which returns the path to the original item which is pointed to by the Alias at the path aliasfile.
To help you incorporate similar Alias creation and resolution features in your own code, it comes with its own source code, which you are free to modify and incorporate as you wish.
alisma version 2 has been available for over a year, but this article also announces the release of a new version 3, which is a Universal binary, so will run native on both Intel and Apple Silicon Macs. That’s particularly important with command tools, as the last thing that you want on your shiny new Apple Silicon system is a call to any command to have to wait for Rosetta 2 to translate an Intel binary to run on ARM processors.
I’ve already explained how mixing Intel-only apps and tools can pose problems: it’s far better on an Apple Silicon system to run a complete calling chain using a single architecture where you can. This update now makes this possible.
I hope that it proves useful to you. I will continue to leave its last Intel-only version available from its Product Page, in the event that you encounter any problems with this new version.
While you’re thinking about Finder Aliases, another utility which can be very useful is Alifix, also available as a Universal App. This scans folders deeply to identify and refresh all Finder Aliases, including those made by
alisma. It then reports all that it finds which are broken, and optionally writes an adjacent text file with their internal details to help you repair each Alias. This is available from its Product Page too.
The final utility which I have to offer for Finder Aliases and Bookmarks is Precize, also now available as a Universal App. Drag and drop an item onto Precize and it reveals a great deal of information about it, such as its real total size including any extended attributes, and its inode. It will generate a Bookmark to that item, which can be incorporated into Property Lists and similar. It features a Bookmark Resolver which will attempt to decode and resolve any Bookmark you wish. This too is available from its Product Page.
If there’s something else you need to do with Finder Aliases or Bookmarks which they don’t cover, let me know.