How to Deploy Heroku using your troubled M1 MacBook
I’m sure y’all have heard of Apple’s new low-cost laptop that starts from (only) $999 with a Retina display and Touch ID, and most importantly powered by the new Apple M1 chip!
I don’t know much about computers, but one thing I can tell you that shifting away from the Intel processors and graphic solutions can make or break your experience as a developer, especially if you are introduced to coding for the first time! To be frank with y’all, I had mixed feelings with the M1 performance since it had many conflicts with the environmental setup for my bootcamp.
There aren’t many solutions out there so I am writing this *FREE* solution, hoping that it will reach some other developers that own M1 MackBook who get blocked from using Heroku!
If you are a Flatiron student, skip to Install brew.
Heroku CLI with Rosetta
The Heroku CLI is DOES NOT RUN NATIVELY on the Apple M1 chip. We need to download Rosetta which is the translation process that allows applications designed for Intel processors to run apps on Apple silicon
New Terminal Application
- Go to ‘Finder->Applications->Utilities’
- Right-Click on the Terminal to Duplicate (You may be asked to type your password)
- Right-Click to “Get Info” and check “Open using Rosetta”
Feel free to name your second terminal differently to prevent confusion later on!
Now we have 2 Terminal Apps!
This way we will be able to switch from ARM and Intel mode easily.
Install Rosetta
When you first use “Terminal with Rosetta” you will be asked to install Rosetta or you can also install manually.
/usr/sbin/softwareupdate --install-rosetta
Install brew
Wait, What even is brew?
Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.It provides an incredibly smooth and straightforward experience for anyone familiar with the command line, and it’s a good way to learn the command line if you’re new to it.
If you have installed Homebrew before enabling Rosetta, you have already downloaded M1 compatible packages in your Mac. You can check the work and verify the default location by this command. Homebrew for Apple Silicon is expected to be installed in /opt/homebrew
.
% which brew
/opt/homebrew/bin/brew
Install brew AGAIN!
Open “Terminal with Rosetta” and then install Homebrew again. The expected location Homebrew is instead/usr/local/bin
.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Now You have 2 HOMEBREWS!
To prevent some confusion, it’s smart to create an alias for Rosetta Homebrew.
alias rbrew='/usr/local/bin/brew' #Rosetta brew
% which rbrew
rbrew: aliased to /usr/local/bin/brew % which brew #Native brew
/opt/homebrew/bin/brew
Now you can INSTALL Heroku!
In your CLI you can use Heroku using your Terminal with Rosetta.
Make sure to read your terminal for some simple commands! Soon you will be able to log in to Heroku.
rbrew tap heroku/brew && rbrew install heroku
heroku login
Conclusion
Working on the Apple M1 is an “aight” experience for me. It can be overwhelming since there are some tools that is require the Rosetta layer.
According to one blog posts, The M1 MacBook beat Intel MacBook in every round, it has faster build time, the temperature is way cooler. However, in software development, reliability plays a crucial part too. Most of the time, you want to focus on writing code instead of fixing compatibility bugs. When all development-related tools are switched to native ARM, MacBook Pro will become a great development machine that you can rely on.
Hopefully, in the near future, more applications can migrate to the ARM architecture and the development system will run natively! Until then patching here and there, and some googling shall prevail!