3

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.

1
  • Why would it depend on "what version brew installs"? You install homebrew for either ARM or for X86. Nov 21, 2021 at 2:08

1 Answer 1

4

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.

9
  • Sure, Terminal executes the Shell, the Shell interprets the commands. so can you mix and match architectures here through Rosetta?
    – Woodstock
    Nov 18, 2020 at 20:07
  • 1
    give me a sec...doing this on a phone so typing is slow going.
    – Allan
    Nov 18, 2020 at 20:08
  • 1
    I'll have to check that specifically but it makes no sense. I'm trying to access the Apple documentation but their servers keep timing out. But under FreeBSD, I don't open a Linux Terminal to execute a Linux App. I open the Terminal under FreeBSD....
    – Allan
    Nov 18, 2020 at 20:29
  • 1
    I use MacPorts and just doing a quick look, it appears MacPorts supports compiling on ARM (as I suspected) See: github.com/macports/macports-base/blob/release-2.6/ChangeLog. So, if you wanted the very latest Bash shell on ARM, all you'd have to do is compile/install it (sudo port install bash). That of course depends if they've made the necessary changes to the Bash code . I'm trying to figure out what's going on with Homebrew.
    – Allan
    Nov 18, 2020 at 20:42
  • 1
    If the port or the formulae hasn't been modified so that it can be compiled in ARM yet, you have to run it in x86_64 mode. This is what enables the translation layer
    – Allan
    Nov 18, 2020 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .