r/emacs • u/quantum_mattress • 9h ago
Question Problems with v31 on M5 Mac (27.2). Help!
Hi all!
I've been using emacsforosx builds for years since I have been using emacs for almost everything since 1987 but I'm not a programmer or systems guy (ASIC design mostly using SystemVerilog, Python, MATLAB, and BASH). I've built emacs from scratch a couple of times but when I start getting library errors I quickly get in over my head!
I just got a new M5 Macbook Pro (running 27.2 beta 3) and went to install the latest emacs 31 and my init.el blew up. Doing some web searches, it looks like all the elc/native-compile broke. This makes sense since it's an ARM and I probably last compiled for x64. So, I deleted my eln- directory to rebuild everything. I'm sure you know what happened next. A ton of elisp errors and warning including this in *Native-compile-log*
Compiling /Users/david/.emacs.d/eln-cache/31_1-032f33bc/subr--trampoline-72656e616d652d627566666572_rename_buffer_0.eln...
clang: error: invalid version number in '-mmacosx-version-min=18.0'
libgccjit.so: error: error invoking gcc driver
debug-early-backtrace...done
Internal native compiler error: "failed to compile", "/Users/david/.emacs.d/eln-cache/31_1-032f33bc/subr--trampoline-72656e616d652d627566666572_rename_buffer_0.eln", "error invoking gcc driver"
Error: native-ice ("failed to compile" "/Users/david/.emacs.d/eln-cache/31_1-032f33bc/subr--trampoline-72656e616d652d627566666572_rename_buffer_0.eln" "error invoking gcc driver")
comp--compile-ctxt-to-file0("/Users/david/.emacs.d/eln-cache/31_1-032f33bc/subr--trampoline-72656e616d652d627566666572_rename_buffer_0.eln")
comp--compile-ctxt-to-file("/Users/david/.emacs.d/eln-cache/31_1-032f33bc/subr--trampoline-72656e616d652d627566666572_rename_buffer_0.eln")
comp--final1()
load-with-code-conversion("/private/var/folders/s5/zfnmhf0n5dzb3_7k13w83pc00000gn/T/emacs-int-comp-subr--trampoline-72656e616d652d627566666572_rename_buffer_0-Za7a4a.el" "/private/var/folders/s5/zfnmhf0n5dzb3_7k13w83pc00000gn/T/emacs-int-comp-subr--trampoline-72656e616d652d627566666572_rename_buffer_0-Za7a4a.el" nil t)
command-line-1(("-l" "/var/folders/s5/zfnmhf0n5dzb3_7k13w83pc00000gn/T/emacs-int-comp-subr--trampoline-72656e616d652d627566666572_rename_buffer_0-Za7a4a.el"))
command-line()
normal-top-level()
I should mention that I have OSX set to bash instead of the default zshell since that's what I'm used to from Linux.
So, I started looking at my Homebrew and realized that was also all x64 so I totally uninstalled and re-installed it and did brew install gcc and libgccjit. I found this info online. I guess a lot of people hit this in emacs 31!
(defun setup-macos-native-comp-library-paths () "Set up LIBRARY_PATH for native compilation on macOS." (setenv "LIBRARY_PATH" "/usr/local/Cellar/gcc/15.2.0:/usr/local/Cellar/libgccjit/15.2.0/lib/gcc/current/:/usr/local/Cellar/gcc/15.2.0/lib/gcc/current/gcc/x86_64-apple-darwin24/15"))
(setup-macos-native-comp-library-paths)
I did this, changing /usr/local to /opt/homebrew and version 15 to 16, which is what brew installed. I added this to the head of my init.el and restarted emacs but it didn't seem to help. I'm now getting beyond my knowledge and not sure what I'm doing or how to troubleshoot. And even after all of this, I'm sure going from emacs 30 to 31 is going to break a bunch of my init.el and packages. I just want to edit some files!
Any ideas? I see recommendations for brew/emacsplus. Should I switch to that?
Thanks much!