After installation - configuring Mbed CLI
Mbed CLI may not work properly without some manual configuration.
Mandatory: setting PATH variables
Add the following to the system
- The paths for the Git and Mercurial executables (
Mandatory: setting compiler location
You must inform Mbed CLI about the location of your compiler using one of the following methods:
- The Mbed CLI configuration command.
- Setting an environment variable.
- Adding the compiler's directory to your PATH.
Tip: You may configure more than one toolchain. However, you may only use one toolchain at a time. For more information, see the multiple toolchains section below
Method 1: Mbed CLI configuration
Mbed CLI stores its own configuration about compiler locations in both project local settings and user wide global settings. You may set and view these settings with the
mbed config command. For example, set the Arm Compiler 5 location with the command:
$ mbed config -G ARM_PATH "C:\Program Files\ARM" [mbed] C:\Program Files\ARM now set as global ARM_PATH
-G switch tells Mbed CLI to set this as a global setting, allowing all projects your user owns to compile with Arm Compiler 5. If you want only a local setting for
ARM_PATH, omit the
Mbed CLI supports a setting for each toolchain path:
|Toolchain||Example binary location||Setting name||Example path|
|Arm Compiler 5.06u6||
|Arm Compiler 6.11||
|IAR EWARM Compiler 8.32.1||
|GCC Arm Embedded Compiler||
Using Arm Compiler 6 (from Mbed Studio)
Mbed Studio comes with a free version of Arm Compiler 6 for use with Mbed OS. If you want to use Arm Compiler 6 with Mbed CLI:
Install Mbed Studio.
Configure the environment variable
For Mbed Studio 0.5 and later, the Arm Compiler 6 executable is located in the following path:
/Library/Application Support/Mbed Studio/mbed-studio-tools/ac6/bin
Set the environment variable
For Mbed Studio 0.5 and later, the Arm Compiler 6 license file,
ac6-license.dat, is located in the following path:
/Library/Application Support/Mbed Studio/mbed-studio-tools
Note that this environment variable is not managed by Mbed CLI, so you must set it appropriately in your environment.
Method 2: environment variable
In addition to the manually configured compiler locations, Mbed CLI detects executables that are in paths specified by toolchain-specific environment variables.
|Arm Compiler 5||
|Arm Compiler 6||
|IAR EWARM Compiler||
|GCC Arm Embedded Compiler||
Method 3: system PATH
In addition to toolchain-specific environment variables, Mbed CLI detects executables that are in your system
PATH. This means that if you install a toolchain in the system
PATH (different for each OS), Mbed CLI will automatically find the toolchain.
Optional: configuring multiple toolchains
All the settings described in the previous sections can configure a different version of the same toolchain, and Mbed CLI has a set of rules to seamlessly switch between these versions for an individual
mbed compile or
mbed test invocation. Mbed CLI picks the most specific version, from most specific to least specific, in this order:
- Mbed CLI local configuration
- Mbed CLI global configuration
- Environment variables
To use a standard toolchain for general purpose development, you may use any method from 3 to 5. To override a toolchain version for a specific project, you may use methods 1 and 2. All of these methods may coexist.
Optional: add bash tab completion
mbed-cli bash tab completion:
- Navigate to the
- Copy the
mbedscript into your
- Reload your terminal.