Why does my ENV_PATH not work for /sbin?

I have the variable ENV_PATH set to `/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin, as suggested on this page.

But KM’s Execute Shell Script action never recognizes programs in /sbin. When I try to run ping or md5 I get the output:
/var/folders/hh/gfc2h1fj2v3714nsghh8dyb40000gn/T/Keyboard-Maestro-Script-3C9C77DC-1CC9-44D0-A4E9-4DAE59C3EF46: line 1: ping: command not found

It’s easy enough to fix by putting /sbin/ping in the script. But I’m confused as to why the ENV_PATH variable doesn’t work as I expect it to.


I copied the path you state:


And put that in my ENV_PATH variable, and tried:

And it worked fine. I removed the :/sbin from the end, and it failed ping: command not found.

So it appears that /sbin has no particular issues.

My guess would be something like:

  • And invisible character in the ENV_PATH variable.
  • And invisible or other character in the Execute Script action.
  • A typo somewhere (maybe the ENV_PATH variable name).

Try executing the script:

echo $PATH

and see what you get.

Echoing the $PATH variable outputs
as expected. Very odd!

Oh, it turns out there was a newline character at the end of the variable. Deleting that solves the problem. Thanks for your help!

1 Like