Tips and tricks to set up your Apple M1 for development
Tags: development, technology, tips, apple
Published: 2021-01-20 13:56:13

I recently joined Courier as a Software Engineer and part of the onboarding process was to set up and configure my development environment on the new M1 MacBook Pro. This task was more complicated than usual because, with the new MacBooks, Apple has replaced their long-running Intel processors with their own  [M1 chip](https://www.apple.com/mac/m1/). To help you take full advantage of the power of the new MacBooks, here are some tips and tricks I picked up when setting up my own machine.

# Rosetta vs Native Terminal

Command line tools are crucial  for our day-to-day workflows. However, several critical CLI tools like `nvm` and `brew` do not have native versions built for the new M1 architecture, so installing them on your native terminal can be frustrating.
 
Thankfully, with Apple's translation layer [Rosetta 2](https://developer.apple.com/documentation/apple_silicon/about_the_rosetta_translation_environment), we can easily download and compile applications that were built for x86_64 and run them on Apple Silicon. I’ll explain how to duplicate the macOS native terminal and force the duplicated terminal to always run with Rosetta 2. Using this "Rosetta" terminal makes it a breeze to install our preferred tools.

## 1. Create a Rosetta Terminal
First, duplicate the Terminal and rename it.Then,Open Finder and navigate to the Application/Utilities folder and select "Duplicate."

![Duplicate your terminal on Apple M1 MacBook](https://dev-to-uploads.s3.amazonaws.com/i/3ffg9gh9b8blsy42gaqf.png)

Rename this new terminal to something like "Rosetta-Terminal.".Now right-click on your new Rosetta Terminal and click "Get info." 

![Rosetta-Terminal Context Menu](https://dev-to-uploads.s3.amazonaws.com/i/64ly8min17g10h084gf2.png)

From the “Get info” menu, select "Open using Rosetta."

![Rosetta-Terminal Get Info](https://dev-to-uploads.s3.amazonaws.com/i/bq75l7bkwivhjiz6c2rw.png)

Now we have a special terminal that can be used to install our command line tools. During the install, they will be translated by Rosetta. After the install, we can use them from the native terminal.

## 2. Install your tools with the Rosetta Terminal

Let’s install some tools! Now that we have a dedicated Rosetta Terminal, we can install our CLI tools just like we would on an Intel MacBook. In this case, I’m going to install `nvm`, but it’s the same process for any other CLI tool you may need, e.g. Homebrew, AWS CLI, etc.

First, open up "Rosetta-Terminal" using Spotlight (just hit Cmd+Space).

![Spotlight Search Rosetta-Terminal](https://dev-to-uploads.s3.amazonaws.com/i/5pr5du054wkf0gp2a2e4.png)

Confirm that you are using a Rosetta Terminal by entering the `arch` command, which should return `i386`.

![Terminal Arch command](https://dev-to-uploads.s3.amazonaws.com/i/6iwm7ax2wcwo93sp3slz.png)

Next, install nvm:
```shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
```

And then install your preferred node.js version. I'll be using version 12.x

```shell
nvm install 12
```

Now, open up the Native Terminal with Spotlight:

![Spotlight Search Terminal](https://dev-to-uploads.s3.amazonaws.com/i/96fs29jgrwiopplt99hx.png)

Confirm that you are using the Native Terminal by typing the `arch` command, which should return `arm64`. While you are here, you can also validate the installation.

![Terminal Tool Versions](https://dev-to-uploads.s3.amazonaws.com/i/okq4ppc2h4digvuul987.png)

As you can see, nvm, npm and node.js version 12.x have all been successfully translated and installed on Apple Silicon. 🎉

I recommend using the "Rosetta-Terminal" for installing the rest of your command line tools and using the Native Terminal for your daily workflow.

## Finding and installing native applications

Right now, there are still a few applications that don't offer full native support for Apple Silicon. So we have to install the x86_64 versions of these applications. This means that Rosetta will run in the background to translate the application and make it compatible to run on the M1, but this also means that it will not run in its fully ARM optimized glory.

Before you install the rest of your applications, I recommend checking if they offer native support for Apple Silicon. Sometimes, a fully ARM native version is not available, but an ARM optimized beta version is. You can visit the website “[Does it ARM?](https://doesitarm.com)” or [Is Apple silicon ready?](https://isapplesiliconready.com/) and search for any app. It’s a great resource to find and install Apple Silicon versions of your apps.

### Installing VS Code Insiders (beta)

For example, this is what I see when I search for [VS Code](https://doesitarm.com/app/vs-code/):

![DoesItARM VS Code](https://dev-to-uploads.s3.amazonaws.com/i/4yred243hkbapryl2eaf.png)

Currently, VS Code does not fully support a native Apple Silicon version of their software. But they do support a beta release version called Insiders with native support! If you want to try it out, head over to [VSCode Insiders](https://code.visualstudio.com/insiders/). Remember to select the ARM64 version of the application on the download page.

![VS Code Insiders](https://dev-to-uploads.s3.amazonaws.com/i/tjpva1704o5kdpa8dbxb.png)

After installation, open up Visual Studio Code - Insiders (and behold the blazing speed of the M1 🚀), enter cmd+shift+p to open up the Command Palette and install the 'code-insiders' command into your bash PATH.

![VS Code Install CLT](https://dev-to-uploads.s3.amazonaws.com/i/axo6s12cwkxn6jvocr54.png)

After that’s installed, you can open up files with VS Code from your terminal using the code-insiders command. But since nobody has time for that many keystrokes, add this alias to your zshrc or equivalent:

```shell
alias code="code-insiders"
```

Restart your terminal and now you can open up files using the `code` command – like a boss. 😎

---

Other apps are not this difficult to find an Apple Silicon native version. For example, Chrome offers a fully supported ARM64 version of there software:

![DoesItARM Chrome](https://dev-to-uploads.s3.amazonaws.com/i/f0slbn11a2t6t7hp7yhy.png)

On the Chrome download page, make sure to select the version for "Mac with Apple Chip"

![Select Chrome Version](https://dev-to-uploads.s3.amazonaws.com/i/avkeybyw9tockoybxhg8.png)

## Final tip: Checking your app version 

At the time of this writing most applications do offer fully supported ARM64 versions of their software, but a few (like VS Code, [Node Version Manager](https://github.com/nvm-sh/nvm) (nvm) and [Homebrew](https://brew.sh/)) still do not. Over time we should expect to see fully supported Apple Silicon versions of our favorite apps.

As you install applications on your new MacBook, you might notice that some auto-update to the new architecture, while others do not. For example, I noticed that Chrome auto-updated to a x86_64 version. If you suspect that one of your apps is running an older version, you can check the Activity Monitor and see what type is running on your machine:

![Activity Monitor](https://dev-to-uploads.s3.amazonaws.com/i/bq0kjijlaz3k1d7mvvxn.png)

---

I hope you find these tips helpful! If you have any additional tips or questions about how I set up my M1, don’t hesitate to reach out!

Also you can find out more about where I work at [Courier](https://www.courier.com/)