Exporting shell environment variables from Execute Shell Script


The Execute Shell Script action runs in non-interactive mode which means none of the configuration scripts are invoked. Even if I call the configuration file from the first line of my action it doesn’t work. Is there any way at all I can automate the setting up of variables so that I don’t have to start each Execute Shell Script action with three long export commands?


Hey @Sleepy,

How exactly are you doing that?

You can set environment variables in Keyboard Maestro’s Variables preference panel.

See ⇢ “Setting the ENV_PATH Keyboard Maestro Variable” on the wiki:


If you really want to load your config file then you can do something like this in your scripts:

source ~/.bashrc



I did read that wiki page prior to writing my post but didn’t quite grasp the part that I needed to understand. But since you redirected me to it I assumed it would help me and I reread it and indeed it can be used to set any variable not just the PATH variable.

I used to be a UNIX admin (not a very good one) and even then I would forget about the source command. The fact that you put the source command in front of the line of text I had will probably fix that problem. But using the preference panel is probably a better idea for me, thanks!!