Service no longer working on Catalina

I have a Service on macOS that runs an Automator workflow to add a background to a pdf file using the pdftk commandline utility. The Automator worflow basically consist of one step: a shell script that runs pdftk with the right parameters.

Until Catalina this worked without any problem. When I just tried to run it on Catalina I got an error:
The action “Run Shell Script” encountered an error: “Error: Failed to open background PDF file: ....

The “background pdf file” is still there and has never been in another location.

Running the command from a terminal works fine. But if I run it as a Service (from Finder) it throws this error.

It sounds like (another) permission issue caused by Catalina’s new security policies. Problem is, I have no clue how to fix it. Does anyone have an idea? Or encountered something similar?

Sounds similar to something I experienced with CRON and SMB, you might need to give it full disk access in System Preferences.

1 Like

Giving full disk access to either Automator or pdftk didn’t fix the problem.

I think it must be something that should get full disk access, but it’s not clear what yet. It’s hard (if not impossible) to give full disk access to the “run shell script” part of the Automator workflow. But that is in fact the process that runs pdftk.

The only thing I could find online was to give Finder Full Disk Access. Apart from the fact that I don’t know how to do that, since Finder is not in the list of Application, that didn’t seem like a good idea anyway.
So I therefore moved the script to an Alfred Workflow. After some minor changes the script is working fine again.
Problem solved (thanks to Alfred).

1 Like

This is intriguing. Is there any chance you might be able to share a version of the Alfred workflow? Thanks, Simon

Sure.

And this is inside the shell script:

for f in "$@"
do
    DIRNAME="$(dirname "$f")"
	FILENAME="$(basename "$f")"
	TMPNAME="$(basename "$f" .pdf)_frbg.pdf"
    /usr/local/bin/pdftk "$f" multibackground /Users/thatsme/Documents/Letterhead.pdf output "$DIRNAME"/"$TMPNAME"
	mv "$f" "/Users/thatsme/.Trash/"
	mv "$DIRNAME"/"$TMPNAME" "$DIRNAME"/"$FILENAME"
done
1 Like