I am on a Macbook M1 and pdf-tools installation fails with a stack-trace
There have been a number of issues around pdf-tools
installation problems on M1. M-x pdf-tools-install
throws the following stack trace:
1 warning generated.
ld: warning: ignoring file /opt/homebrew/opt/gettext/lib/libintl.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/glib/2.72.1/lib/libglib-2.0.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/poppler/22.02.0/lib/libpoppler-glib.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/glib/2.72.1/lib/libgobject-2.0.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/poppler/22.02.0/lib/libpoppler.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/cairo/1.16.0_5/lib/libcairo.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/libpng/1.6.37/lib/libpng16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/zlib/1.2.11/lib/libz.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
This happens because M1 architecture is ARM64
, whereas the Emacs App you are using has been compiled for the x86_64
architecture. The way to solve this problem is to install a version of Emacs which has been compiled for the M1. As of today, , the latest version of Emacs available on https://emacsformacosx.com/ is natively compiled and you will not face these issues on it. Please remove your current Emacs App and install it from https://emacsformacosx.com/.
Thank you.
PS: How do I know if the Emacs I’m running has been compiled correctly?
You can see this by opening the Activity Monitor
, selecting Emacs
, clicking on the Info
key, and then clicking on Sample
. The Code Type
field in the Sample output will show you how your Application has been compiled. Here is the output for EmacsForMacOSX (you can see that it’s ARM64
):
Sampling process 61824 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Emacs-arm64-11 (pid 61824) every 1 millisecond
Process: Emacs-arm64-11 [61824]
Path: /Applications/Emacs.app/Contents/MacOS/Emacs-arm64-11
Load Address: 0x1007f0000
Identifier: org.gnu.Emacs
Version: Version 28.1 (9.0)
Code Type: ARM64
Platform: macOS
If your Emacs is compiled for x86, the Code Type
will be x86_64
.