March 15, 2021, 6:02pm
I assume this is an easy fix, but I have searched the forum and the wiki and not found the problem. I am using a keystroke (Cmd-L) to copy the URL from Firefox, assigning it to a variable ("Address") and attempting to access that variable in shell script that calls the
clean-mark app, installed by Brew to
Execute Shell Script section of the macro, I have this command:
/usr/local/bin/clean-mark "$KMVAR_Address" --stdout
This works perfectly on the command line, where "$KMVAR_Address" is replaced with the URL of the webpage to convert to Markdown. But when I run it in KBM, the script fails with the following error:
Execute a Shell Script failed with script error: env: node: No such file or directory.
Note: this seems to be similar to the (currently unresolved) problem encountered here: Execute Shell Script Help
The Execute a Shell action launches a vanilla shell instance with no connection to or knowledge of your Terminal.app settings.
Here for example, nothing tells it where or what your Node installation is, and it doesn't yet have the requisite PATH settings.
To see what it does have, try:
March 15, 2021, 6:39pm
Good idea! I ran the first one and it turns out that
PATH only includes
node is at
/usr/local/bin/node (as are all the other Brew-installed apps).
I have added
PATH=$PATH:/usr/local/bin as the first line in my shell script and
clean-mark now works, as it is able to find
Is there a means of setting KBM's default
PATH to include
/usr/local/bin so I don't need to specify it every time I run a shell script?
Others may correct me, but I think we always need to do that explicitly.
(unless, of course, you want to write a custom KM plugin)
ENV_PATH (the Keyboard Maestro Path Variable) prior to the Execute Shell Script Action.
See How To Set a Path
this is easily done manually using the KM Editor Preferences > Variables pane.
Split this topic
March 16, 2021, 10:28pm