32

As a developer, I have experienced major issues with installing languages, libraries and development tools from the command-line as Apple M1 has migrated over to using arm64 instead of x86_64 architecture.

In order to bridge the gap before all libraries and tools change over to arm64, and to avoid library incompatibilities between architectures, in many cases it may be easier for developers to just emulate x86_64 to perform their library installs.

jksoegaard
  • 77,783
sonjz
  • 839
  • 3
    Note that Mojave was the last version to support i386 - The intel arcitecture now supported is is x86_64 – mmmmmm Oct 12 '21 at 20:20
  • 1
    It might also be easier for Apple Silicon to use Macports which has supported that since it was released. Which languages and libraries are not ARM? – mmmmmm Oct 12 '21 at 20:21
  • yeah i386 is strange, more here for arch https://stackoverflow.com/a/12763379/740575, updated to be more clear it was for x86_64 – sonjz Oct 13 '21 at 02:12
  • hmm we had several m1s setup over the past quarter, found this was best solution as we use brew. dual brew and pyenv abandonment is where i stopped to take another look – sonjz Oct 13 '21 at 02:27
  • What does " dual brew and pyenv abandonment" mean? – mmmmmm Oct 13 '21 at 09:55

1 Answers1

36

After installing Rosetta:

softwareupdate --install-rosetta --agree-to-license

It seems to be a good idea to run your entire Terminal in Rosetta:

  • Go to Finder > Applications and find your Terminal (this can also be other terminal app, like iTerm in my case)
  • Right-Click the App and Duplicate it and rename it "Terminal x86_64"
  • Right-Click "Terminal x86_64" > Get Info > Enable Open using Rosetta
  • Click to Open the Terminal, type arch to verify it says x86_64 now.
  • Right-Click the Terminal x86_64 in your Dock and click "Keep in Dock" for future use.

It is important to install/update/deploy within the "Terminal x86_64" window now, your normal Terminal will be arm64 and won't have the same libraries. Consider full emulation as the easiest solution without a lot of workaround with flags and running multiple brew in parallel. It just works.

Source: https://betterprogramming.pub/5-things-i-have-learned-when-using-the-m1-chip-macbook-air-a77f93c50381#5a64

Míng
  • 327
sonjz
  • 839
  • 2
    Does anyone else find it odd that 'arch' returns "i386", yet that refers specifically to 32-bit Intel ISA, which hasn't run on macOS since Mojave? The industry has adopted "amd64" and "arm64" as the names of the two prevalent ISAs. – Rob_vH May 18 '22 at 13:44
  • 2
    it should be x86_64, probably didn't refactoring from i386, probably didn't matter until they noticed the issues requiring arm64 compiled binaries. amd64 appears to be a subset of x86_64 ‍♂️ – sonjz May 19 '22 at 17:36
  • amd64, x64, and x86_64 are interchangeable names. :) – Rob_vH May 23 '22 at 21:04
  • 1
    @Rob_vH i see that now. found something regarding your question: https://stackoverflow.com/a/12763379/740575 – sonjz May 25 '22 at 01:01
  • 1
    uname -m # machine hardware name -> x86_64, uname -p # machine processor architecture name -> i386, and arch -x86_64 command .... # run command in x86_64 arch. So, Terminal-x86_64.app would be better. – Míng Oct 10 '22 at 06:05
  • 15
    macOS 13 doesn’t let me duplicate my terminal anymore. Is there any solution for this yet? – gernophil Oct 25 '22 at 19:47
  • 1
    @gernophil there is a way to set terminal to the version mentioned here: https://developer.apple.com/forums/thread/718666 – Mario Petrovic Nov 01 '22 at 10:52
  • 4
    Regarding macOS 13, in case this is of any use here's a solution I detailed in the Apple forums which isn't great but worked for me. https://developer.apple.com/forums/thread/718722?answerId=740569022#740569022 TLDR use Automator to make an Application that does Run Shell Script with osascript -e 'tell app "Terminal" do script "arch -x86_64 zsh" end tell' – rsethc Dec 23 '22 at 18:01
  • My MacOS Apple Silicon prints "i386" as well if I type "arch" on a terminal with Rosetta mode. – chattershuts Jun 07 '23 at 09:17
  • The automator script from @rsethc above is the only way I could get an i386 terminal open – TonyM Jun 27 '23 at 04:49