Fixing command not found errors in Shortcuts.app
macOS has an easy way to create useful small automations: Shortcuts.app. Shortcuts is the next generation Automator.app and I wanted to create a simple shortcut to start and stop Colima, the “new” Docker hotness, and put it in my menu bar.
This, however, is not that post. Instead it’s a story about configuring
$path correctly while running shell scripts in Shortcuts.
Shortcuts created in Shortcuts.app consists of one or multiple
Actions. One of these actions is
Run Shell Script and my idea was to simply use that action to call
colima start and go on with my day.
Surprisingly at the time,
colima start returned an error instead of enabling Docker:
command not found: colima
The reason being that the
$PATH variable differs between the shell script action and the path used by Terminal.app. Thus, we need to append the
nix binary directory to path for it to find the needed binaries:
Great success, the path to the Docker-shortcut is clear 🥳