Automator Plugin

Hi, I was trying to create an automator plugin for the first time, but the documentation for this appears to be very dated. It suggested that I would be able to debug this by running the Automator executable with my plugin name/location as an argument (spcifically -action "${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}"). However, when I tried to run within Xcode, all I see is this message:


Message from debugger: cannot attach to process due to System Integrity Protection


Since the "System Integrity Protection" is new, I am guessing that the automator plugin documentation was not updated to show how we can debug such a plugin. Are Automator plugins no longer supported? If they are, does anymoe know how to debug one?


Best,

Jaime

Replies

Since the "System Integrity Protection" is new, I am guessing that the automator plugin documentation was not updated to show how we can debug such a plugin.

Correct.

Are Automator plugins no longer supported?

They are still supported just fine.

If they are, does [anyone] know how to debug one?

That’s a bit tricky. To start, I recommend that you get up with speed with System Integrity Protection (SIP):

The issue here is that the Automator app is part of the base OS install, and thus is considered a restricted process by SIP, and thus you can’t attach to it with the debugger. This is a good thing in general, but makes it hard to debug your Automator action.

Clearly we need a better solution to this problem. You should file a bug requesting that, then post your bug number, just for the record.

As to workarounds, there are two that I can think of:

  • disable SIP — The instructions for doing this are in the System Integrity Protection Guide, however, I generally recommend against this except as a last resort.

  • create your own Automator — If you make a copy of Automator and replace the code signature with your own signature (using the command install), the system no longer considers it part of the base OS install. You can then set it as the target executable in Xcode and debug from there.

    $ codesign -s "Developer ID" -f Automator.app Automator.app: replacing existing signature

Note This assumes you have a Developer ID code signing identity in your keychain. If not, you should get one.

You may run into some odd misbehaviours here. For example, if your copy of Automator accesses the keychain, it’ll likely run into problems because it claims to be Apple code but isn’t signed by Apple. However, it should allow you to get started with the basics.

IMPORTANT Obviously this is a hackish workaround, hence my advice earlier that you file a bug requesting a real solution to this problem.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
(r. 20561723)

Thank you for the workaround. I did submit a bug as #23580755.


Best,

Jaime

The same thing affects System Pref Panes. Five years and no results so I would not ever expect this to work. Sigh.