Shell scripts don't work on new Mac

I am sure this is something obvious and I have searched the forums but...

I have been using KM for years. Love it. I got a new Mac Studio with my year end bonus. It is all set up and working except for the fact I can't seem to get shell scripts to execute in KM.

I created a simple one:

I currently have my macros sync'd to the "old" machine (Intel Mac Mini) where it works perfectly (pops up a window with the results of the command). Nothing happens on the new machine when I hit Run. I checked Accessibility permissions for both KM and KME. What am I missing?

It definitely seems like a permissions issue. What does the engine.log file show when you run the macro? (KM > Help > Open Logs Folder then open in a text editor).


I did not know the logs were there. Thanks. But seems like an odd message..

2023-12-29 11:48:12 Execute macro “Test Shell Script” from trigger Editor
2023-12-29 11:48:12 Action 10940 failed: Execute a Shell Script failed with script error: text-script: line 1: ls: command not found
2023-12-29 11:48:12 Execute a Shell Script failed with script error: text-script: line 1: ls: command not found. Macro “Test Shell Script” cancelled (while executing Execute Shell Script).

What happens if you make it look like this:

ls -lrt

To me, that error message is basically saying that Keyboard Maestro doesn't know anything about the shell environment, but I thought that was supposed to be automatically handled.


Didn't change anything. The only command I have found so far that works is pwd

Shut down KM and KME, restarted Mac, shut Mac down and restarted it. Still no luck. I will keep exploring but it is very odd. I will update if I figure it out. Thanks for trying.

Very strange indeed.


And I found it.

At one point, I was trying to get a shell script working and found a post here (can't find it now) that had a script that would ensure the KM shell environment had the same path as the terminal. I downloaded and ran that script and for some reason, the ENV_PATH variable it created in settings was the actual command I was trying to get to work. Once I deleted that ENV_PATH variable, everything worked as it should. Thank you @griffman for the help! The script was called "Make ENV_PATH Variable in Keyboard Maestro using the Terminal v1.00"


Nice sleuthing!