Skip to content

Instantly share code, notes, and snippets.

@simonhildebrandt
Created October 12, 2021 22:03
Show Gist options
  • Save simonhildebrandt/afd8dbbcdd3af0234fc7dd25b572fac0 to your computer and use it in GitHub Desktop.
Save simonhildebrandt/afd8dbbcdd3af0234fc7dd25b572fac0 to your computer and use it in GitHub Desktop.

Developing on an M1 Mac

Lots of our commonly-used OSX development tools have been updated to support Apple's new bespoke silicon, but a few remain incompatible, and it's challenging to work around them individually. In my recent experience several approaches were attempted to work around this - below is the approach we found most consistently successful.

The terminal-based, full emulation approach

Apple provides a tool called Rosetta2 which provides a full emulation layer for any Intel code you might want to run on their new architecture. It's awkward to run each tool we use under emulation individually, though - our approach here is to start our top level process (a terminal app) under emulation, and run all our tools and processes subordinate to that.

  1. Install Rosetta2. softwareupdate --install-rosetta.
  2. Choose / Install a suitable terminal program. OSX comes with the Terminal application - but consider using the much more fully featured iTerm2 instead (available from Homebrew via brew install --cask iterm2.)
  3. Verify your archictecture. Open your terminal app and run uname -m - for an M1 processor you should see arm64.
  4. Open you Applications folder and make a copy of your terminal app. Rename it to reflect that it'll be running via emulation - "iterm2 - emulated", for example.
  5. Update settings to run the new app under emulation. Right-click on the new app and choose 'Get info'. In the 'General' panel check the "Open using Rosetta" option.
  6. Verify your architecture. Open your terminal app and run uname -m - With emulation active you should see x86_64.
  7. Install the rest of your tools in this terminal. tools installed from Homebrew, RVM, NVM, etc - everything that tries to do native compilation should be run from inside this terminal. Then anything that uses these tools - Rails processes, etc, should also be run from inside this terminal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment