Execute Shell Script with Path of Finder not working


Hey there, I´m using the nice little Dropshare App, to upload files directly to Google Drive and get the download link into my clipboard. They offer a Mac CLI so I want to integrate it in my KM automations. But somehow it is not working with a KM Variable (of the Finder Path) in the shell command. This is the macro i use and the Notification when triggered:


it works fine if I test it in Terminal. Does it maybe have something to do with this here writen in their User Guide?:

Please make sure that /usr/local/bin is part of your PATH environment variable. Check this question on StackOverflow if you are unsure how to do this.


You can also locate the program ds with

which ds

in Terminal, and reference the program in KM using the full file path, e.g.

/usr/local/bin/ds "$KMVAR_Path"


Hey @CJK, thanks for your reply, just tried your suggestion, "which ds" in terminal gave me "/usr/local/bin/ds" back, so I used this in the shell script: /usr/local/bin/ds "$KMVAR_Path" - but again without success, get a notification that the macro is cancelled:



don´t know why, but I deinstall and installed the CLI again, and now it works! Thank you!


Glad to hear it's sorted. You can see actually from the nature of the errors, which were different in both cases, that supplying the full path to the program (/usr/local/bin/ds) was successful in allowing KM's shell script action to locate the program. The subsequent errors that came after that were originating from the execution of the ds program itself, which I can only guess must have somehow become corrupt or been altered, as it was generating syntax errors from within its source code. That's probably why reinstalling helped, as it must have just got rid of a corrupted version and given you a fresh one with the correct source code.


I've only been using Dropshare recently and had created a macro using the Finder service to upload files and save the link to the clipboard...

I don't know exactly what it is about the Mac CLI in Dropshare @Pierre_Schmidt? What exactly would I use if I set it up?


yes that were also my thoughts, I just tried some things and saw that the error notification changed, my last option was to reinstall it and now it works fine, thanks again for your help!


to use it via the finder option is also a nice way to use it, the CLI allows you to use Dropshare via Terminal Commands, after installing it you can use it just with the command "ds" and then the path of the file you want to upload (just drop the file into terminal window) - But it also allows me to use it with Variables that I created before in KM, my example is with Photoshop, to quickly upload a jpg file to google drive and get the download link into my clipboard:

  1. Trigger a Photoshop Action (to resize the image)
  2. User Input for asking for the file name (instead of adding "_Version12" etc. I use a timestamp at the end
  3. Plugin "Choose Folder(s)" to choose the path for saving
  4. Applescript to save the file to a .jpg
  5. And then execute a Shell script with the Variable that includes the filename/path

The CLI would make also sense to use it in combination with hazel so you can automaticly trigger the shell script when files are placed in a folder/have a new color tag etc.


Many thanks for the very good explanation for the use of the CLI. This is very interesting and I will take a closer look at it now.
The thought with Hazel excites me... my rainy Sunday is saved.

Greetings from Frankfurt :wink:


you are welcome!
Beste Grüße aus der Hauptstadt :slight_smile:


Hey Pierre,

Clearly you had something odd going on with your installed version of ds.

@CJK has shown you how to use an absolute path, but you should be aware of the other ways you can manage executable paths in Keyboard Maestro.

Be aware that the wiki has at least some information on every command and function and usually has fairly detailed information.

Execute a Shell Script action

See the subsection on paths:


Create a PATH Environment Variable for Keyboard Maestro and Add /usr/local/bin to the Default Path

More discussion