Question

How does Big Sur and ARM (Apple) silicon handle the following permutations?

Say I run Terminal as x86_64 using Rosetta2, then does that mean I must use a x86_64 shell?

If indeed I use an x86_64 shell, can it only execute x86_64 processes or Universal bins?

Similarly, if I use a native Apple Silicon Terminal, does it mean I must run an ARM shell?

I hope what I'm asking makes sense.

I ask as really what I'd like to do is use Home-brew a certain way. I want to use an ARM version of iTerm2 (Universal binary), then run latest ZSH (may be x86_64 depending on what version brew installs, then also use a mix of ARM and Intel binaries.

Was it helpful?

Solution

There's some mis-understandings about what each of the elements are...

  • Terminal - The terminal is just the utility that allows you to execute commands. Think of it as a "window" into the system. You can open a Terminal on a PowerPC Mac, then establish a connection to an a new M1 Mac that in turn connects to X11 desktop running on Linux on an Intel CPU. In other words, the Terminal doesn't determine what environment you ultimately work in. If you're on the new M1 Mac, the Terminal will be the native M1 compiled Terminal.

  • The shell is the environment in which you operate; it's the actual user interface. You're probably familiar with Bash and Zsh (default shell since Catalina). This too will operate as the native compiled environment, so if you're on the M1 it will use the shell compiled for that platform. The shell is just how you send commands to the OS to do things including run binaries.

  • Executing binaries depends on what that binary was compiled for. We know that a Linux binary (even compiled on x86) won't run on macOS. The binary has to be compatible or you need something that gives you that compatibility. For example, FreeBSD has a Linux compatibility layer. This is where Rosetta comes in; to make Intel instructions compatible on Apple ARM.

Rosetta is the tool or "layer" that allows you to run x86_64 instructions on the ARM chip. So, if you want to execute a widget that is only available on x86_64, you would run that on Rosetta.

So, using your example, you would run the universal binary of iTerm2 (native to ARM) to use the universal binary Zsh shell that was compiled on ARM to either launch the universal binary tool natively compiled on ARM or the x86_64 tool compiled under Intel via Rosetta.

From the comments:

I wonder why Homebrew team are suggesting to open terminal under Rosetta?

Doing some related research on MacPorts, there are many, many ports that do not yet support compiling under ARM; Bash is one of them and I've included the Port Health page for reference. See below:

enter image description here

They will tell you to open Terminal (or iTerm2) under Rosetta to ensure you're initializing an x86_x64 environment.

If a binary includes both arm64 and x86_64 instructions, the user can tell the system to launch the app using Rosetta translation from the app’s Get Info window in the Finder. For example, a user might enable Rosetta translation to allow the app to run older plug-ins that don’t yet support the arm64 architecture.

Open With Rosetta

So, Terminal (or iTerm2) will be universal (runs natively under ARM) but the environment will be able to support the x86_64 instruction set.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top