1

Context: Catalina (zsh is default)

The drop and drag instructions were followed per: http://hildstrom.com/projects/2011/08/bates-number-a-pdf/index.html#mac

enter image description here

Attempts to follow the procedure first returned:

enter image description here

Terminal then returned:

enter image description here

ctivityReport.pdf"; exit
user@JUPITER ~ % '/private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/AppTranslocation/596EF513-EE76-40D6-A64E-E9667AEAF23F/d/bates-label-a-pdf.app/'../bates-label-a-pdf.sh "/Users/user/Desktop/Exhibits_ActivityReport.pdf"; exit
zsh: no such file or directory: /private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/AppTranslocation/596EF513-EE76-40D6-A64E-E9667AEAF23F/d/bates-label-a-pdf.app/../bates-label-a-pdf.sh

[Process completed]

The goal is to understand why the procedure did not return the expected .pdf file and any actionable remedy. I suspect that there may be a security setting that may need to be configured. Thank you

PION test results

per pion's instructions to overcome the AppTranslocation issue:

user@JUPITER bates-label-a-pdf % xattr -rd com.apple.quarantine /Users/user/Desktop/bates-label-a-pdf

CPU = Intel i3770 (not M1). Execution returned Bad CPU type in executable errors:

user@JUPITER ~ % '/Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/'../bates-label-a-pdf.sh "/Users/user/Desktop/bates-label-a-pdf/Exhibits_ActivityReport.pdf"; exit
/Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../bates-label-a-pdf.sh: line 18: /Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../pdftk/bin/pdftk: Bad CPU type in executable
/Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../bates-label-a-pdf.sh: line 21: /Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../labeling/generate-labeling-pdf: Bad CPU type in executable
/Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../bates-label-a-pdf.sh: line 22: /Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../pdftk/bin/pdftk: Bad CPU type in executable
mv: /Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../labeling/labeling.pdf-compressed: No such file or directory
/Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../bates-label-a-pdf.sh: line 26: /Users/user/Desktop/bates-label-a-pdf/bates-label-a-pdf.app/../pdftk/bin/pdftk: Bad CPU type in executable
1
  • 1
    The pdftk and generate-labeling-pdf executables are Mach-O executable i386 and therefore will not run under macOS Catalina. They need to be Mach-O 64-bit executable x86_64 to run under macOS Catalina. Commented Nov 24, 2021 at 16:59

1 Answer 1

4

tl;dr: App Translocation.

The Bates Label solution that you linked was written for macOS 10.7-10.8. In macOS 10.12 Apple began restricting non-Mac App Store apps from running unsigned code. Instead, macOS will create a random disk image, copy the application onto it, and execute the app from that image. Any external resources that the app depends upon are not copied, so if the app expects them to be found at a path that's relative to the app's original binary, you will see "file not found" errors.

That's what appears to be happening in your case. Here is the sequence:

  1. You downloaded and unzipped a tarball containing bates-label-a-pdf.app, an unsigned app.
  2. When you attempted to run that app, macOS translocated it to a random path (/private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/AppTranslocation/596EF513-EE76-40D6-A64E-E9667AEAF23F/d/bates-label-a-pdf.app/).
  3. The app seems to be a wrapper for the bates-label-a-pdf.sh script, which the app was expecting to be found in the same directory as the app itself, hence the ../bates-label-a-pdf.sh relative path specification.
  4. Since macOS did not copy the external shell script when it translocated the app, the app can't find it, and you get your "no such file or directory" message.

One workaround is to remove the com.apple.quarantine extended filesystem attribute from the app before running it. I explain this in longer form in Should I enter this command in Terminal?. The command in your case would be:

xattr -rd com.apple.quarantine /path/to/app/location

where you would replace /path/to/app/location with the actual filesystem path to bates-label-a-pdf.app, wherever you put it. (According to the author's web page, that is supposed to be ~/Desktop/bates-label-a-pdf/bates-label-a-pdf.app but it's possible that you left it inside your Downloads folder instead.)


If you're curious, here is the script code inside the app:

AppleScript code for the bates label app

6
  • The shell scripts need to be put inside the app bundles - as well as the pdftk executable
    – mmmmmm
    Commented Nov 24, 2021 at 11:47
  • @pion Thank you for a clear & understandable explanation. Please see the eponymous test results at the end of the OP. Can you confirm that the App Translocation problem is no longer an obstacle? I suspect that it is, however, I would like someone with more experience to confirm. Thank you
    – gatorback
    Commented Nov 24, 2021 at 13:20
  • @pion I believe that you included the script code inside the app so that the reader can evaluate security risk of running the app?
    – gatorback
    Commented Nov 24, 2021 at 13:21
  • @mmmmmm Thanks for your insigh.: Based on the last error message: does it confirm that the .sh and pdftk executable are in the app bundle?
    – gatorback
    Commented Nov 24, 2021 at 13:28
  • No pdtkf and the .sh are not inside the app bundles - that is the problem - if they were they would be copied to the translocated path
    – mmmmmm
    Commented Nov 24, 2021 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .