Setting up my development environment on a new M1 MacBook
If you’re like me — a junior developer who just bought a new MacBook with the latest M1 chip to continue building your coding skills — you’re in luck! You’re not alone in wondering why setting up your development environment through HomeBrew in Bash is such a challenge. Nothing is a fire and this challenge too shall pass… according to Apple, more or less.
HomeBrew is a terminal app that, as far as I know at this moment, does not fully offer Apple ARM (M1 chip) support yet.
Developers far more experienced than I have posted some helpful blogs about their process in setting up their development environments and I’ll link their articles below as well as document the combination of steps that worked for me.
# Link 1: https://soffes.blog/homebrew-on-apple-silicon
- If you’d like to use Homebrew, you’ll have to install it with rosetta 2, using the command provided in the article above.
- I highly recommend setting up the ‘ibrew’ alias that is suggested in this article since you would ideally set up HomeBrew again once Apple and HomeBrew roll out something official.
- I made the choice to stick with Apple’s default .zsh terminal shell setup rather than use .bash
- My MacBook did NOT already have a .zshrc file where my rosetta 2 alias would be outlined, so I made sure I ran the following:
(do not include “<>” in your command)
<touch ~/.zshrc>
<open ~/.zshrc>
and entered this line: <alias ibrew=‘arch -x86_64 /usr/local/bin/brew’>
# Link 2: https://apple.stackexchange.com/questions/388622/zsh-zprofile-zshrc-zlogin-what-goes-where
- This link is helpful in explaining the differences among:
.zprofile
.zshenv
.zshrc
.zlogin
.zlogout - As of posting this story, all I’ve had to interact with have been .zprofile and .zshrc
- If you followed along so far with all the commands PLUS setting up the alias, then you should be using “ibrew” ahead of anything to which you previously used “brew”. For example, “brew install node” NOW = “ibrew install node”. We did this to eliminate the need for the Rosetta prefix from the first linked article. Keep this in mind as you install anything else!!
** You should be able to install other packages that you would have normally installed with brew in the past. The only other thing I want to note is that the latest Node version supports M1 (version 15.3.0). I found this out when I tried to create a React App and got a JS allocation error while I was using version 15.2.1.
After installing NVM, run:
<nvm install 15.3.0>
<nvm alias default 15.3.0>
<nvm use 15.3.0>
Hopefully these steps help you set the HomeBrew foundations you’d need on your new MacBook. There are a number of ways out on the interwebz that outline installing packages natively without HomeBrew, as well. Feel free to share any resources on that if you have them, as I’d love to check those out!
Happy coding!
-Ruby