Shell script to update Homebrew doesn't work anymore

I used this shell script in KM to update homebrew every morning and it has been working for over 3 months without any issues. But now, it brings up an error

"Execute a Shell Script failed with script error: text-script: line 1: brew: command not found. Macro "Trying" cancelled (while executing Execute Shell Script)."

The script works perfectly if I use it directly in the Terminal app. Any idea how to remedy this?

Thanks.

Something changed in your Keyboard Maestro environment and it no longer has your $PATH variable, from the looks of things. You can try setting it again; see the ENV_PATH section of this page:

https://wiki.keyboardmaestro.com/action/Execute_a_Shell_Script#Path_in_Shell_Scripts

Alternatively, you can do what I do, which is to just always provide the full path when using a non-built-in Terminal command:

/opt/homebrew/bin/brew update ... etc.

-rob.

2 Likes

Thanks a lot. That worked!