Have you encountered errors trying to install older versions of dbt on your fancy, new MacBook? This could be related to compatibility issues with the new M1 CPU. Dependency packages written for Intel CPUs can cause issues preventing proper installation. But don’t worry, Apple provides an Intel emulator called Rosetta. Below are the steps that worked for me.
Before we go through our instructions, please note that I am installing dbt 0.20.2 as my example. Your results may vary depending on the version you need. Also be aware that I found this process successful with CLI dbt, but still encounter issues with virtual environments, like “dbtevn.”
With those notes in mind, here are the steps I recommend:
- Start by referencing the dbt Install Documentation. dbt includes specific instructions for installation on an M1 Mac. There are 2 important considerations to take note from this documentation:
- We need to run our commands through Rosetta to emulate an Intel chip.
- We will also follow the pip install instructions instead of brew as we will have to be careful about our Python version to match the old dbt version’s requirements.
- I found this guide to be most helpful in setting up a Rosetta terminal environment. It also shows you how to use that terminal environment directly in vscode. $uname -m is a helpful command to check if you are correctly emulating the Intel architecture.
- I followed this guide to set up Python. I specifically followed pyenv instructions as Python versioning is important to the necessary dependencies. I install Python 3.9.7 as that was the most recent version when dbt v0.20.2 was deployed.
- Pip install dbt using your Rosetta terminal. Here are the dbt docs for reference.
- I had to downgrade the MarkupSafe dependency package.
- Don’t forget to set up your profiles.yml file in the .dbt root directory.
- Here is one other guide for reference that doesn’t use pyenv
At this point you should be able to run dbt successfully from the CLI. I hope this helped you overcome some of the challenges I ran into.