Running tmux on an M1 Mac in arm64 mode
Asked Answered
A

3

15

So I have tmux installed via arm64 homebrew.

I initially compiled alacritty (my favorite terminal emulator) for arm64 manually, so that's running in arm64 mode. uname -a confirms we're in arm64.

Darwin ndo-mbp.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101 arm64

Then I installed homebrew which slowly but surely getting arm64 bottles for most popular applications, including tmux (https://github.com/Homebrew/brew/issues/7857). So I installed that from the arm64 shell, it compiled successfully.

If I run file $(which tmux) I get:

/opt/homebrew/bin/tmux: Mach-O 64-bit executable arm64

However, if I launch that tmux binary in my arm64 alacritty, I seem to land in x86_64 mode. Running uname -a from inside that tmux window I get:

Darwin ndo-mbp.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101 x86_64

Any idea what's going on here? I'm relatively new to Mac OS, so maybe I'm missing something obvious.

Ardussi answered 23/12, 2020 at 22:32 Comment(4)
What is your default shell? (finger $USER)Carleycarli
Consider removing your ~/.tmux.conf to see if the behavior persists - in particular, maybe you are declaring a default shell in your .tmux.conf.Carleycarli
Thanks that put me on the right track. I manually specified the zsh binary as the default shell in tmux and then it finally returned arm64 inside tmux as well!Ardussi
I'd like to add that I struggled with the above answer (nobodies fault, I'm just a noob). What I did was instead of creating the config file the traditional way (~/.tmux.conf) I explicitly put the file in /usr/local/etc/ (still naming it tmux.conf), as that's where tmux would look for it anyway, and it worked.Fouquet
F
6

I had the same problem.

In the end the solution was in the ~/.tmux.conf, add: set-option -g default-shell /path/to/arm64/zsh

Then kill and restart tmux:

sudo kill -9 [PID of tmux]
tmux

uname -a then returns arm64.

Fraktur answered 23/1, 2021 at 1:13 Comment(0)
B
4

Just a short note on previous suggestions on setting default-shell - /bin/zsh and /bin/bash are universal binaries, which means that it is not guaranteed in which mode you will run. At least in my case - it was running in x86_64 mode. To solve this - I have used default-command by explicitly selecting the architecture:

set-option -g default-command "arch -arch arm64 /bin/zsh"
Bicolor answered 8/5, 2023 at 5:42 Comment(0)
A
2

Now that the M1 CPUs have been around for a while and the community has had time to figure things out, I manually cross compiled Alacritty for arm64 as they don't have official binaries yet (Github Actions apparenlty won't build them yet).

But from there, I was in alacritty in arm64 mode (uname -m == arm64 :thumbsup:) and was then able to remove and reinstall brew and tmux the recommended way from their websites.

Followed all instructions and was good to go. I think just having been a bit early and messing around making manual changes here and there threw the whole thing off.

I do have one unrelated problem now however - and that's that tmux won't start as a non-root user. It just immediately crashes haha. When started with sudo, it opens with my expected config and uname -m confirms it is the arm64 version, however I can't get it to start with my normal user. Anyway, problem for another day!

Ardussi answered 19/7, 2021 at 20:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.