Shell scripts: permissions changed with El Capitan?

I found a very useful macro to automatically add a border and a drop shadow to screenshots (useful in my job): http://agileadam.com/2015/10/automatic-dropshadow-and-border-on-mac-os-x-screenshots/

I modified the flow a bit, but my biggest problem is that the Shell environment I can access from the Terminal app is different from the one I can access via KM or AppleScript for that matter. The environment variables are not the same to start with:
In Terminal, ‘echo $PATH’ gives me the following answer:

/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/opt/X11/bin:/Users/michiel/drush:/Users/michiel/.composer

Which covers the ImageMagick software I need for my macro.

If I do the same from within KM with a Execute Shell Script step, I get the following path:

/usr/bin:/bin:/usr/sbin:/sbin

Has this something to do with SIP and such in El Capitan? Is there a way around this? Because I think this is the reason my macro doesn’t work. It cannot execute the convert command, but it does that fine in a Terminal window…

Thanks & cheers --Mike

The Execute a Shell Script action executes script in non-interactive mode (see the INVOCATION section of the bash man page). As such none of your profile scripts (like ~/.profile) will be executed. This means that custom environment variable settings will not be applied, in particular any settings for your PATH environment variable, and any settings for tool-specific environment variables like PERL5LIB). You can set these by creating a variable with “ENV_” at the start (eg ENV_PATH or ENV_PERL5LIB) and settings its value appropriately.

That absolutely did it! Works like a charm now. Should I post the macro?

Thanks --Mike

Please do. See:
How to Post/Upload Your Macro to the Forum

Pretty much always.

If the intention is just to show how the particular question you asked was resolved, post the macro as a reply within the topic.

If the macro is likely to be useful (or instructive) to basically anyone else, then post it as a new topic in the macro category.

I would be very happy to see a significant uptick in the number of macros posted and I hope personally to start going through my macros at posting the useful or instructive ones.

3 posts were split to a new topic: Add dropshadow to screenshots

Since @Michiel posted his updated macro here it might be hard to find.
So I moved it to the "macro" category:

1 Like