# macOS

macOS has its roots in FreeBSD and with that in the "original" Unix distributed by Bell Labs in the 1960s. All macOS releases since Mac OS X Leopard (except OS X Lion) have been UNIX certified. With that, macOS gives an environment that offers everything needed for the assignments.&#x20;

{% hint style="success" %}
This setup guide is universal for both **Apple Silicon (M1/M2/...)** and **Intel** Macs. The steps that **must be ignored** on Intel Macs are marked with <mark style="color:yellow;">(Only on Apple Silicon)</mark>.
{% endhint %}

***

## Step 1: Install VS Code

Download [Visual Studio Code](https://code.visualstudio.com/download) (VS Code) for macOS and move the application to your "Applications" folder (depending on your browser you may need to unzip the downloaded archive first).

Now, to also enable the `code` command for your terminal, follow these steps:

1. Open VS Code and press **⌘⇧P** to open the Command Pallete.
2. In the prompt, enter "**install code**" and select the option named:\
   &#xNAN;**"Shell Command: Install 'code' command in PATH".**
3. Confirm the prompt that will pop up and enter your password to finish the installation.

***

## Step 2: Install the Command Line Tools

Open a **Terminal** window and enter:

```bash
xcode-select --install
```

If the command line tools are not yet installed, a window should pop up with a prompt to do so. Follow all the steps of the installer, it may take a few minutes to download and install all the tools needed.

***

## Step 3: Install Homebrew

[Homebrew](https://brew.sh) is a convininet package manager for macOS. We will use this program for the next step. Open a **Terminal** window and enter:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

Enter your password and press the _Enter_ key when prompted. The command takes around 2 minutes to run.

***

## Step 4: Install CMake

Open a **Terminal** window and enter:

```bash
brew install cmake
```

***

## Step 5: Install Rosetta 2 <mark style="color:yellow;">(Only on Apple Silicon)</mark> <a href="#rosetta-install" id="rosetta-install"></a>

Open a **Terminal** window and enter:

```bash
softwareupdate --install-rosetta
```

When prompted, type 'A' and press enter to install.

***

## Step 6: Install Docker <mark style="color:yellow;">(Only on Apple Silicon)</mark> <a href="#docker-install" id="docker-install"></a>

Navigate to the [Docker Desktop](https://docs.docker.com/desktop/setup/install/mac-install/) page and download the version corresponding to your architecture. Double click on the donwloaded `.dmg` file and drag-and-drop the application.

<figure><img src="https://446709468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkIfjAP0St3jlymiCJIij%2Fuploads%2FGGnu5ZjhDXnDmEZAzElP%2FScreenshot%202025-02-10%20at%2016.59.47.png?alt=media&#x26;token=e3dc24d7-f72c-4e95-b4b5-63136a892661" alt="" width="375"><figcaption></figcaption></figure>

Once installed, open Docker Desktop and navigate to Settings <img src="https://446709468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkIfjAP0St3jlymiCJIij%2Fuploads%2F4OAi9b76npmiivp3MAFZ%2FScreenshot%202025-02-10%20at%2017.01.58.png?alt=media&#x26;token=c30156a4-615b-4272-b8a7-c4a407b502a3" alt="" data-size="line">. In the general section, ensure the following settings are enabled:

* [x] Start Docker Desktop when you sign in to your computer
* [x] Use Rosetta for x86\_64/amd64 emulation on Apple Silicon

The framework provides a script that will run Docker for you, so you do not have to worry about understanding the internal procedures. Docker will be used to contain your executables to test for memory errors. Learn more in the [address sanitization](../../reference-documentation/address-sanitization) section.

***

## Step 7: Set up SSH with GitHub

One of the easiest ways to access your GitHub account (and with that your private repository) is to set up a Secure Shell (SSH) key. Follow the [GitHub SSH Setup Guide](../github-ssh-setup) for this.
