简体   繁体   中英

How to solve "pdftk: Bad CPU type in executable" on Mac?

I want to use pdftk but I always get this error zsh: bad CPU type in executable: pdftk I reinstalled pdftk and I changed the terminal from bsh to zsh as I found in my search for how to solve this error but without any success. I'm using the latest MacOS version "Catalina v10.15.4"

This version of pdftk works on macOS Catalina (10.15).

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg

The link on the website is not up to date. That means by clicking the download button on the website you get an old version.

As a preliminary solution, I was successful in installing the Intel version of homebrew in /usr/local (in parallel to the M1 version in /opt/homebrew) using Apple's Rosetta 2 layer. The Intel packages (homebrew formulae) seem to work without any problem on the Apple M1 architecture. Both pdftk and pandoc work even without prefixing 'arch -x86_64' (eg, the command 'pandoc sample.md -o sample.html' as in the example linked below).

Commands:

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
alias ibrew='arch -x86_64 /usr/local/bin/brew'
ibrew analytics off
ibrew install pdftk-java
ibrew install pandoc

Further information:

The macos-10.11 link above worked for me on macOS 10.15 Catalina.

I emailed Sid Steward at PDF Labs about the old link. Hopefully he will update it on the PDF Labs website ;-)

Homebrew:

brew install pdftk-java

https://formulae.brew.sh/formula/pdftk-java

Compatible with Catalina, Big Sur

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM