# 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="/files/VaiunG3BCrSXjKOnnJHw" alt="" width="375"><figcaption></figcaption></figure>

Once installed, open Docker Desktop and navigate to Settings <img src="/files/d2yHMxUAQlbr02v4qu3R" 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](/co-lab-manual/reference-documentation/address-sanitization.md) 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](/co-lab-manual/setup-guides/github-ssh-setup.md) for this.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://computerscienceeducation.gitbook.io/co-lab-manual/setup-guides/technical-setup/macos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
