1. Install dependencies
Instructions for Windows
- Download and install Python 2.7.x (which includes
- Download and install Git (versions 1.9.5 or later are supported).
- Download and install Mercurial (versions 2.2.2 or later are supported).
Instructions for macOS
macOS 10.8 and later comes with Python 2.7 preinstalled.
If you are using the preinstalled version but need to install
pip, you can run the following command (taken from the pip installation guide):
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py
If you are running an earlier version of macOS, download and install Python from the official website. This package includes
Download and install Git (versions 1.9.5 or later are supported).
Download and install Mercurial (versions 2.2.2 or later are supported).
Instructions for Linux
Linux distributions typically manage software through package managers. The specific commands to install the dependencies will vary depending on your distribution. Please see your distribution's documentation for more information.
As an example, the following is a command to install all dependencies on Ubuntu:
sudo apt install python2.7 python-pip git mercurial
2. Install Mbed CLI
Note: We suggest you install Mbed CLI from within a virtual environment and run all commands from within your virtual environment. This will ensure that changes made by the Mbed CLI installation do not propagate to the rest of your system and cause unexpected changes in behavior in any existing Python installation.
To install Mbed CLI with pip:
pip install mbed-cli
To verify Mbed CLI installed correctly, run
To update Mbed CLI, run:
pip install -U mbed-cli
3. Install a compiler
Download and install one of the following compilers: GCC Arm, Arm Compiler 5, Arm Compiler 6 or IAR.
Note: When installing the Arm Compiler 5 on a 64-bit Linux system, you may also need to install the i386 architecture package. As as example on Ubuntu:
$ sudo dpkg --add-architecture i386 $ sudo apt-get update $ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
4. Configure the compiler location
To build project, Mbed CLI needs to know where the compiler is installed. It checks three configuration options in the following order:
- Mbed CLI config (local first, then global).
- Environment variables.
- System path.
Configure compiler location with Mbed CLI
If you cannot place the compiler in the system PATH, or if you have to use a different version of the compiler than the one in your system path, you must configure the location of the compiler with Mbed CLI. Use the
mbed config command to set the compiler's location:
$ mbed config -G ARM_PATH "C:\Program Files\ARM" [mbed] C:\Program Files\ARM now set as global ARM_PATH
-G argument sets the location globally, so that it applies to all projects. You can omit the argument if you are configuring a compiler location for a specific project.
Mbed CLI supports a setting for each toolchain path:
|Toolchain||Setting name||Example binary location||Example path|
|Arm Compiler 5.06u6||
|Arm Compiler 6.11||
|IAR EWARM Compiler 8.32.1||
|GCC Arm Embedded Compiler||
Configure compiler location with environment variables
You can set the location of the compiler with environment variables. Use the path listed in the previous section Configuring compiler location with Mbed CLI.
|Arm Compiler 5||
|Arm Compiler 6||
|IAR EWARM Compiler||
|GCC Arm Embedded Compiler||
Install compilers in the system PATH
Installing the compilers in the system PATH will allow the tools to automatically discover the compilers without further configuration. Most compiler installers have an option to add the compiler to the system PATH for you.
mbed-cli bash completion:
- Clone the Mbed CLI repository:
git clone https://github.com/ARMmbed/mbed-cli.
- Navigate to the
- Copy the
mbedscript into the
~/.bash_completion.ddirectory (you may need to create this directory first).
- Restart the terminal.