|
| 1 | +# Alias Tools |
| 2 | + |
| 3 | +Tools for working with MacOS alias files. |
| 4 | + |
| 5 | +Includes two universal binaries: `readalias` and `mkalias`, |
| 6 | +for resolving and creating alias files. |
| 7 | + |
| 8 | +Neither is very thouroughly tested. |
| 9 | + |
| 10 | +I wrote these utilities for my own needs, on Tahoe 26.2, |
| 11 | +but they likely work on some earlier verions of macOS. |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +Download the [latest release](https://github.com/heckman/macOS-alias-tools/releases/latest) |
| 16 | +and put the two universal binaries somewhere on your `PATH`. |
| 17 | + |
| 18 | +Alternatively, build the binaries from source. |
| 19 | +You will neet to have Command Line Tools (CLT) installed, |
| 20 | +which can be installed with `xcode-select --install`. |
| 21 | +Clone [the repository](https://github.com/heckman/macOS-alias-tools), |
| 22 | +and change your current directory to its root. |
| 23 | +From there, run `./build`. |
| 24 | +This should produce the `readalias` and `mkalias` binaries |
| 25 | +in a `./bin` directory. |
| 26 | + |
| 27 | +## Features |
| 28 | + |
| 29 | +At the moment, `readalias` simply prints the path to the original item, |
| 30 | +and has no options beyond `--help` and `--version`, |
| 31 | +while `mkalias` can be given the `force` ( or `-f`) option |
| 32 | +indicating existing files should be overwritten--by default it |
| 33 | +is non-destructive. |
| 34 | + |
| 35 | +Both respond well to the `--help` option, producing output which |
| 36 | +includes descriptions their various exit codes. |
| 37 | + |
| 38 | +### Future features |
| 39 | + |
| 40 | +By default `mkalias` will fail if the file specified for |
| 41 | +the new alias already exists, adn will overwrite it if the |
| 42 | +destructive behaviour is selected with the `force` (or `-f`) option. |
| 43 | + |
| 44 | +I indend to offer a third behaviour, which, when the |
| 45 | +specified name for the alias is taken, generates a new name |
| 46 | +in the way the Finder does. This might become the default |
| 47 | +behaviour in which case we will need a new a command-line |
| 48 | +option for the fail-on-existing file behaviour. |
| 49 | + |
| 50 | +The renaming strategy is this: Use the same name as the original, |
| 51 | +if avaialbe, otherwise append ` alias` to the name. If that |
| 52 | +is still not unique, then append the smallest integer |
| 53 | +greater than one, separated by a space, sufficient to |
| 54 | +generate a unique name. |
| 55 | + |
| 56 | +### Edge Cases |
| 57 | + |
| 58 | +These tools have only been nominally tested, |
| 59 | +and most edge cases have not been explored: |
| 60 | + |
| 61 | +- Broken Aliases |
| 62 | +- Aliases to unmounted external/network volumes |
| 63 | +- Creating and Alias to another Alias |
| 64 | + |
| 65 | +## Props where due |
| 66 | + |
| 67 | +Prior to writing these two tools, |
| 68 | +I was using _alisma_, by Howard Oakley, |
| 69 | +which you can find on his site |
| 70 | +[eclecticlight.co](https://eclecticlight.co/) |
| 71 | +where he shares a great number of useful tools. |
| 72 | + |
| 73 | +I found myself wrapping _alisma_ in shell functions to |
| 74 | +provide interfaces that felt more natural to me, |
| 75 | +so I decided to use the same system calls as _alisma_ |
| 76 | +to make two new programs: `readalias` and `mkalias`. |
0 commit comments