# Arm GNU Toolchain

## About this Install Guide
This guide shows you how to install and use the tool with the most common configuration. For advanced options and complete reference information, see the official documentation. Some install guides also include optional next steps to help you explore related workflows or integrations.

Arm GNU Toolchain is a community-supported, pre-built GNU compiler toolchain for Arm-based CPUs. In this guide, you’ll learn how to install the toolchain directly from the [Arm GNU Toolchain downloads page](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads). This is the recommended approach for bare-metal and embedded targets such as `arm-none-eabi`.

For a cross-compiler targeting Arm Linux (for example `aarch64-linux-gnu` or `arm-linux-gnueabihf`), see the [Cross-compiler](../cross) install guide instead, which installs those toolchains using the Linux package manager.

There are many versions of the [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) available. We generally recommend the latest version, as this will contain the latest optimization improvements and support for the latest Arm IP.

However, there are reasons you may wish to use earlier compiler versions, so older versions are also available.

See also [Where can I get older versions of the Arm GNU Toolchain and GCC for Arm Platforms?](https://developer.arm.com/documentation/ka005611/latest)

## Download the Arm GNU Toolchain
Arm GNU Toolchain releases consist of cross toolchains for the following host operating systems:

- **Linux**
  - Available for x86_64 and AArch64 host architectures
  - Available for bare-metal and Linux targets

- **Windows**
  - Available for x86 host architecture only (compatible with x86_64)
  - Available for bare-metal and Linux targets

- **macOS**
  - Available for x86_64 and Apple silicon host architectures
  - Available for bare-metal targets only

Download the correct toolchain variant for your development needs from the [Arm Developer website](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads).

## Install the Arm GNU Toolchain on Linux
Unpack the downloaded file to the install directory. The exact file name will depend on the flavor selected and will be formatted as follows:

```bash
tar xJf arm-gnu-toolchain-<version>-<host-arch>-<TRIPLE>.tar.xz -C /path/to/install/dir
```

Add the `bin` directory to the `PATH` environment variable (bash):

```bash
export PATH=/path/to/install/dir/bin:$PATH
```

The following is an example of a specific version for an Arm Linux host and the AArch32 bare-metal target:

> **Note:** The following commands uses Arm GNU Toolchain version 15.2.Rel1. The same commands work with other versions. Replace the file used in these steps with the file for your version of choice. To find the latest version, see [Arm GNU Toolchain downloads](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads).

```bash
wget https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi.tar.xz
tar xJf arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi.tar.xz -C $HOME
echo 'export PATH="$PATH:$HOME/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi/bin"' >> ~/.bashrc
source ~/.bashrc
```

## Install the Arm GNU Toolchain on macOS
Downloads for `macOS` are available as tar files (`.tar.xz`) and package files (`.pkg`).

### tar files
For `.tar.xz` files, unpack the downloaded file to the install directory. Replace the `<version>` and `<host-arch>` with the version and host architecture of your choice:

```bash
tar xJf arm-gnu-toolchain-<version>-<host-arch>-<TRIPLE>.tar.xz -C /path/to/install/dir
```

### pkg files
For `.pkg` files, use the installer. Replace the `<version>` and `<host-arch>` with the version and host architecture of your choice:

```bash
sudo installer -pkg arm-gnu-toolchain-<version>-<host-arch>-<TRIPLE>.pkg -target /
```

### Update the search path
Use a text editor to add the `bin` directory as a new line in `/etc/paths`.

For example, for version 15.2.rel1, the path could be: `/Applications/ArmGNUToolchain/15.2.rel1/arm-none-eabi/bin`

The `/etc/paths` file is a list of paths to search:

```
/usr/local/bin
/System/Cryptexes/App/usr/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/ArmGNUToolchain/15.2.rel1/arm-none-eabi/bin
```

### Apple Silicon
The following is a specific example for macOS with Apple Silicon and the AArch32 bare-metal target:

> **Note:** The following commands use Arm GNU Toolchain version 15.2.Rel1. The same commands work with other versions. Replace the file used in these steps with the file for your version of choice. To find the latest version, see [Arm GNU Toolchain downloads](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads).

```bash
wget https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-darwin-arm64-arm-none-eabi.pkg
sudo installer -pkg arm-gnu-toolchain-15.2.rel1-darwin-arm64-arm-none-eabi.pkg -target /
echo '/Applications/ArmGNUToolchain/15.2.rel1/arm-none-eabi/bin' | sudo tee -a /etc/paths
```

## Install the Arm GNU Toolchain on Windows
The steps depend on the release version.

### Releases prior to 15.2.Rel1
Double-click the installer, such as `arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi.exe`, and follow the on-screen instructions.

The installer can also be run on the command line. When run on the command line, you can set the following options:

- `/S` Run in silent mode
- `/P` Adds the installation `bin` directory to the system `PATH`
- `/R` Adds Install Folder registry entry for the install.

For example, to install the tools silently, update the search path and add the registry entry run. Replace `<version>` with a release version prior to 15.2.Rel1 of your choice:

```bash
arm-gnu-toolchain-<version>-mingw-w64-i686-arm-none-eabi.exe /S /P /R
```

The zip package is a backup to Windows installer for those who can’t run the installer. You can unzip the package and then run the tools directly.

### Releases starting from 15.2.Rel1
Double-click on the installer, such as `arm-gnu-toolchain-15.2.rel1-mingw-w64-i686-arm-none-eabi.msi`, and follow on-screen instructions.

To install silently from the command line, run the following. Replace `<version>` with a release version starting from 15.2.Rel1 of your choice:

```bash
msiexec /i arm-gnu-toolchain-<version>-mingw-w64-i686-arm-none-eabi.msi EULA=1 /quiet
```

The zip package is a backup to Windows installer for those who can’t run the installer. You can unzip the package and then run the tools directly.

## Setting up product license
Arm GNU Toolchain is open source software. You don’t need any licenses to use it.

To use the Arm GNU Toolchain with [Arm Development Studio](https://developer.arm.com/Tools%20and%20Software/Arm%20Development%20Studio), you need to [register the toolchain](https://developer.arm.com/documentation/101469/2022-0/Installing-and-configuring-Arm-Development-Studio/Register-a-compiler-toolchain).

## Verify the installation
To verify the installation is correct, enter:

```bash
arm-none-eabi-gcc -v
```

Additional examples are included in the toolchain installation. If you installed to `$HOME` using the example provided in this guide, you can find them at:

```
$HOME/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi/share/doc/gcc-arm-none-eabi/examples
```

You’re now ready to use Arm GNU Toolchain.
