3.5 KiB
M1 Mac Setup Guide
This guide should get you set up to run bigquery-etl
on an M1 or M2 Mac. The
reason you need to take some extra steps here is because M1/M2 Macs run on
Apple CPUs that use ARM architecture, as opposed to what older Macs use, Intel
CPUs on x86 architecture. There are currently some compatibility issues between
some of our dependencies and ARM. To get around this, we'll use Rosetta, which
is an x86 emulator.
You're free to set this up however you like, but in this guide we'll set up 2
parallel Homebrew versions, one for ARM and one for x86 (in Rosetta), create
aliases for the two, and install all of bigquery-etl
's dependencies in
Rosetta mode.
For tips on maintaining parallel stacks of python and homebrew running with and without Rosetta, see blog posts from Thinknum and Sixty North.
❗ These instructions will install everything in Rosetta mode and assume that you can do all your work in Rosetta mode.
If you need to work with other repos outside of Rosetta mode (esp in Python) these steps are probably not right for you -- ask in #data-help for advice on getting set up
-
Install Rosetta if you don't have it yet
softwareupdate --install-rosetta
-
Set Terminal to run in Rosetta mode:
-
In Finder, go to Applications -> Utilities
-
Right-click on Terminal and choose Get Info
-
Check the box "Open using Rosetta"
-
Open a new Terminal session and run
arch
. This will show you the current architecture -- it should outputi386
. If you're not in Rosetta mode, it will outputarm64
-
(Optional) You can add the current architecture to your prompt -- add the following to your
~/.zshrc
or/.bashrc
:setopt PROMPT_SUBST PROMPT='$(arch) %~ %# '
-
-
Install Homebrew:
-
Still in your Rosetta mode shell, follow the instructions at https://brew.sh/ to install Homebrew
-
This will have installed Homebrew to
/usr/local/bin/brew
; now we'll add some aliases -- add the following to your~/.zshrc
or/.bashrc
:alias brew86='/usr/local/bin/brew' alias brewm1='/opt/homebrew/bin/brew' alias brew='echo "Use brew86 or brewm1"'
You'll now use
brew86
to install things to Rosetta Homebrew andbrewm1
to install to ARM Homebrew. The third alias I added because I kept just typingbrew
out of habit without knowing which one I was using -
Delete the following line from your
~/.zprofile
or~/bash_profile
if you previously added it:eval "$(/opt/homebrew/bin/brew shellenv)"
-
-
(Recommended) Clear out non-Rosetta versions of software that's used in
bigquery-etl
:-
If you installed Python 3.10 via pyenv, uninstall it with
pyenv uninstall 3.10.6 # (or whichever version you have installed)
-
If you installed pyenv, uninstall it:
brewm1 uninstall pyenv
-
If you're using tmux or something like that, uninstall that too and reinstall via
brew86
-
-
Install the core
bigquery-etl
dependencies viabrew86
:brew86 install pyenv
-
Install python; you'll need to install
xz
firstbrew86 install xz pyenv install 3.10.6 # (or whichever version)
You should now be set to run through the bigquery-etl
setup instructions