I encountered this command while trying to find a workaround for installing old version of npm packages that came out before m1 mac (darwin arm64)
I understand that this will try to launch a zsh session with x86_64
architecture. (although running arch
again will give me i386
which is somehow compatible with x86_64
I think.)
But as far as my knowledge goes, architecture is defined in hardware as processor chips. And to emulate a different architecture you need some heavier software like virtualbox or qemu.
So what does the arch -x86_64 zsh
actually do? Does it actually emulate a different architecture?
I tried reading the man arch
stuff, but too much stuff to actually understand for me.
...
DESCRIPTION
The arch command with no arguments, displays the machine's architecture type.
The other use of the arch command is to run a selected architecture of a universal binary. A universal
binary contains code that can run on different architectures. By default, the operating system will select
the architecture that most closely matches the processor type. A 64-bit architecture is preferred over a
32-bit architecture on a 64-bit processor, while only 32-bit architectures can run on a 32-bit processor.
When the most natural architecture is unavailable, the operating system will try to pick another
architecture. On 64-bit processors, a 32-bit architecture is tried. Otherwise, no architecture is run, and
an error results.
The arch command can be used to alter the operating system's normal selection order. The most common use is
to select the 32-bit architecture on a 64-bit processor, even if a 64-bit architecture is available.
The arch_name argument must be one of the currently supported architectures:
i386 32-bit intel
x86_64 64-bit intel
x86_64h 64-bit intel (haswell)
arm64 64-bit arm
arm64e 64-bit arm (Apple Silicon)
...