# macOS

{% hint style="success" %}
**Updating RL Swarm to the CodeZero Environment**

Run `git pull`, then restart your swarm.

1. **Docker users:** Run `docker-compose run --rm --build -Pit swarm-cpu`
2. **Script users:** Rebuild your venv by running: `rm -rf .venv && python -m venv .venv && source .venv/bin/activate`
   {% endhint %}

## Overview

This guide walks you through setting up RL Swarm on macOS.

RL Swarm can run on both Intel and Apple Silicon (M1, M2, or M3) Macs. On macOS, RL Swarm runs in CPU-only mode by default, as NVIDIA GPUs are not supported on this platform.

### Prerequisites

Make sure your system meets the minimum requirements and that you also have any additional dependencies installed.&#x20;

* macOS Monterey (12.0) or newer
* A 64-bit arm64 or x86 CPU with at least 32 GB RAM, or an officially supported NVIDIA GPU (3090, 4090, 5090, A100, H100)
* Python 3.10+
* [Docker](https://www.docker.com/) installed and configured
* Stable internet connection
* [Git](https://git-scm.com/install/) installed

### Installing Dependencies

1. To start, install [Homebrew](https://app.gitbook.com/u/d4yrITUISyacwKieX5GLAdXoqmp1) if you don’t already have it by running this command in Terminal:

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

2. Then, use Homebrew to install the required packages:

```bash
brew install python git docker
```

3. Launch Docker Desktop after installation (you can find it in **Applications**). Once open, allow it to initialize and complete its setup process.

#### Configuring Docker

Make sure the Docker daemon is running before continuing.&#x20;

Next, you'll want to allocate enough system memory to Docker. You can do this by going to **Settings > Resources > Advanced > Memory Limit** and setting the memory value to the highest available value.

To verify Docker is working correctly, run the following command in Terminal:&#x20;

```bash
sudo docker run hello-world
```

If you see a success message, your installation is good to go.

#### Clone the RL Swarm Repository

1. Navigate to your home directory and clone the RL Swarm GitHub repository using this command:

```bash
git clone https://github.com/gensyn-ai/rl-swarm.git
```

2. Then move into the project folder:

```bash
cd rl-swarm
```

### Run RL Swarm

You can now start RL Swarm using the following Docker command inside your terminal:

```bash
docker compose run –rm –build -Pit swarm-cpu
```

If you hit an error saying “`docker-compose: command not found`” use “`docker compose`” (without the hyphen), as this is the syntax used by modern Docker versions.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FL7K5V5vz218KIXj5n9tk%2Frl_swarm_initial_spin_up.png?alt=media&#x26;token=7afb4980-3cca-4f39-b209-668d15093287" alt=""><figcaption></figcaption></figure></div>

#### Log into RL Swarm

When you start RL Swarm, it will open a browser window automatically pointing to `http://localhost:3000.`

{% hint style="info" %}
If the browser does not open automatically, navigate to that address manually.
{% endhint %}

You will see the RL Swarm login screen powered by Alchemy. From here, you can log in using your preferred method such as Google or email.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FX0C3iUj5CCbikzrVE5Rv%2Fgensyn_login_screen.png?alt=media&#x26;token=2a764a99-8d48-4b83-80a3-049d1c591d78" alt=""><figcaption></figcaption></figure></div>

After login, a `swarm.pem` file will be created in your repository folder. This identifies your peer on the Gensyn Testnet.

***

### Joining the new RL-Swarm Environment (CodeZero)

#### Updating via git pull

First, start by running `git pull` to fetch the latest changes to RL Swarm.&#x20;

#### Launching after Updating

There are two launch paths.

1. **Launching with Docker:** If you are using Docker, you can restart your swarm after updating via `git pull` by using one of the two following commands:

```bash
docker-compose run --rm --build -Pit swarm-cpu
```

2. **Launching with Shell Script:** If you are using the `run_rl_swarm.sh` script, you must remove your old virtual environment and create a fresh one:

```bash
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
/run_rl_swarm.sh
```

{% hint style="success" %}
In both cases, restart your swarm after updating.
{% endhint %}

***

#### Huggingface

If you would like to upload your model to Hugging Face, enter your Hugging Face access token when prompted. You can generate one from your Hugging Face account, under [Access Tokens](https://huggingface.co/docs/hub/en/security-tokens).

#### Verify your Node

Once you are logged in, your node will begin training automatically.

You can verify that your peer has successfully connected by visiting the [Gensyn Testnet Dashboard.](https://dashboard.gensyn.ai/) Your peer should appear in the active swarm list, and you can monitor training progress in real time.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FDWHs4gYzjRqDnRQyjz8z%2Fimage.png?alt=media&#x26;token=5f706d42-3174-4469-9fef-1ee3c17fda80" alt=""><figcaption></figcaption></figure></div>

#### Optional: Experimental Mode (No Docker)

If you want to experiment with the [GenRL](https://github.com/gensyn-ai/genrl) library or the [configurable parameters](https://github.com/gensyn-ai/rl-swarm/blob/main/rgym_exp/config/rg-swarm.yaml), we recommend you run RL Swarm via shell script:

```
python3 -m venv .venv
source .venv/bin/activate
./run_rl_swarm.sh
```

{% hint style="info" %}
This method gives you access to GenRL’s configuration parameters and experimental features.
{% endhint %}

To learn more about experimental mode, check out our [getting started guide](https://github.com/gensyn-ai/genrl/blob/main/getting_started.ipynb) on Github.

### Troubleshooting

Refer to the multi-platform [RL Swarm Troubleshooting guide](https://docs.gensyn.ai/testnet/rl-swarm/troubleshooting) for unblocking information and fixes to common set-up issues.

{% hint style="success" %}
If you need additional support, you can [open a ticket](https://github.com/gensyn-ai/rl-swarm/issues) or [visit our Discord.](https://discord.com/invite/gensyn)
{% endhint %}
