Hacker News new | ask | show | jobs
by xenadu02 2044 days ago
Stickiness of architecture is a change from how Rosetta worked in the PowerPC to Intel transition: in macOS Big Sur child processes will prefer the arch of the parent process if one is available to maximize compatibility. So for example launching x86_64 sh will cause a python invocation from that shell to also be x86_64.

The "arch" utility is your escape hatch to switch the preferred arch for the spawned process and all of its children.

1 comments

Would be easy to make iTerm2 launch arch -x86_64 <shell>
I haven't tried this (don't have an M1 to hand!) but:

iterm2 -> Preferences -> Profiles -> General

Change the "Login Shell" drop down to "Command" and then enter `arch -x86_64 /usr/local/bin/zsh` or whatever your shell is.

Would `arch -x86_64 $SHELL` work?
In theory yes, since it inherits the shell env from the parent.

Haven't got the $$$ to test though.

EDIT: you could also craft an oneliner if $SHELL is not defined, something like:

`ps -T $$ | awk 'NR==2{print $NF}' | arch -x86_64 $0`

Just tried and it works :) .. Nice.