简体   繁体   English

如何在 Mac 上解决“pdftk:可执行文件中的错误 CPU 类型”?

[英]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.我想使用 pdftk 但我总是收到此错误zsh: bad CPU type in executable: pdftk我重新安装了 pdftk 并将终端从 bsh 更改为 zsh,因为我在搜索如何解决此错误但没有任何成功。 I'm using the latest MacOS version "Catalina v10.15.4"我正在使用最新的 MacOS 版本“Catalina v10.15.4”

This version of pdftk works on macOS Catalina (10.15).此版本的 pdftk 适用于 macOS Catalina (10.15)。

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg 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.作为初步解决方案,我使用 Apple 的 Rosetta 2 层成功地在 /usr/local 中安装了英特尔版本的自制软件(与 /opt/homebrew 中的 M1 版本并行)。 The Intel packages (homebrew formulae) seem to work without any problem on the Apple M1 architecture. Intel 软件包(自制程序)在 Apple M1 架构上似乎没有任何问题。 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).即使没有前缀“arch -x86_64”(例如,命令“pandoc sample.md -o sample.html”,如下面链接的示例中所示),pdftk 和 pandoc 都可以工作。

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.上面的 macos-10.11 链接在 macOS 10.15 Catalina 上对我有用。

I emailed Sid Steward at PDF Labs about the old link.我通过电子邮件向 PDF Labs 的 Sid Steward 发送了关于旧链接的邮件。 Hopefully he will update it on the PDF Labs website ;-)希望他能在 PDF Labs 网站上更新它;-)

Homebrew:自制:

brew install pdftk-java

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

Compatible with Catalina, Big Sur与大苏尔 Catalina 兼容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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