Runar Ovesen Hjerpbakk

Software Philosopher

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.

Toggle Docker support shortcut in 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.

Adding Run Shell Script action

Surprisingly at the time, colima start returned an error instead of enabling Docker:

Command not found

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:

Fixing path
PATH=~/.nix-profile/bin:$PATH

Great success, the path to the Docker-shortcut is clear 🥳