• Robert John

How to Set Up the Raspberry Pi Pico for Development on macOS

Updated: Dec 10, 2021

An image of the Raspberry Pi board along with a pinout list
Raspberry Pi Pico Pinout

The Raspberry Pi Pico is an easy development board to get started with. Flashing a binary is as simple as dragging a file onto it like a flash drive while it is in BOOTSEL mode. As a result, the board doesn't need to be connected while you are coding or building.

This how-to will show you how to set up a development environment using either Visual Studio Code or CLion on macOS. Both IDEs will require configuring CMake, which is what is used to build the code.

Install the Toolchain

Run the following commands from the terminal

brew install cmake
brew tap ArmMbed/homebrew-formulae
brew install arm-none-eabi-gcc

Clone the Repositories

Run the following commands from a folder of your choice to clone the pico-sdk repository

git clone -b master https://github.com/raspberrypi/pico-sdk.git 
cd pico-sdk
git submodule update --init

Next, run the following command to get the full path of the pico-sdk


Next, copy the path and export it as PICO_SDK_PATH environment variable in your ~/.bash_profile

You will need to restart your terminal for the environment variable to work. Alternatively, you can run the following command

source ~/.bash_profile

Next, fetch the examples by running the following commands from your terminal

cd ..
git clone -b master https://github.com/raspberrypi/pico-examples.git 

Configure an IDE

You will need an IDE to make development practical. Whatever IDE you choose, you will need to configure CMake.


Using CLion, open up the pico-examples folder. Be sure to confirm that you trust cmake. You will be met with an error asking you to configure PICO_SDK_PATH. Follow the steps below to accomplish that.

  1. Click on the CLion menu name

  2. Click on Preferences

  3. Open up the Build, Execution, Deployment section

  4. Click on CMake

  5. On the right on the screen, in the Debug profile, fill out the Environment field with the appropriate value of your pico-sdk path as shown in the example below.

A screenshot of the CMake configuration screen on CLion
Configuring the CMake option on CLion

You will notice that I added a Release profile. You may choose to do so as well. If your settings are correct you will see an output similar to the following at the bottom of the IDE.

A screenshot showing the successful build operation on CLion
CMake Build Successful

You are now ready to run a build using one of two methods:

  • You can build all of the artifacts by using the Build menu.

  • You can build one artifact by selecting it from the dropdown in the middle of the toolbar.

A screenshot of CLion showing a build artifact selection
Choosing a build artifact

I will proceed to build the blink artifact. You could take a look at the folder named blink within the pico-examples folder. It is made up of two files: a code file and a make file.

To start the build, click on the icon that looks like a hammer to the left of the dropdown. You will see some scrolling text in the build window. You should see a message with "Build Finished" when this completes.

A screenshot of a complete build execution
CMake build complete

The resulting binary file will be in a folder called blink within a folder called cmake-build-debug (because my build used a debug profile).

A screenshot showing the file location after the build execution
The result of the build process

At this point, you have a .uf2 file that you can flash onto your pico.

Visual Studio Code

VSCode is a pretty popular IDE. If you happen to be using it then follow these steps to set it up to work with CMake.

First, navigate to your pico-examples folder, then run the following commands

mkdir .vscode
cd .vscode
touch settings.json

Next, open up settings.json with your favorite editor and populate it with the following.

{ "cmake.environment": { "PICO_SDK_PATH":"../../pico-sdk" } }

Next, open the pico-examples folder in VSCode.

Next, install the CMake Tools extension by clicking the Extensions icon and searching for "CMake Tools". Click on the Install button for the CMake Tools extension from Microsoft.

When done, the IDE will ask whether you would like to configure the project to work with CMake.

A pop-up asking if you would like to configure the project to work with CMake
Configure the project

Click on Yes, and a menu will be presented at the top. Select the GCC compiler from Arm.

A screen asking you to pick the compiler to use
Specify the Arm GCC compiler

Next, click on the settings icon (wheel) under the profile icon on the left side of the screen, and choose settings.

Next, expand Extensions and click on CMake Tools.

Next, locate Cmake:Generator

Fill in the text field with "Unix Makefiles" as shown in the image below.

That's all you need to do. However, it's also advisable to install the C/C++ extension from Microsoft.

The VSCode configuration will add a folder called build to your pico-examples. All of your build outputs will be contained there.

The bottom toolbar will give you buttons for choosing your build option (debug or release) as well as running the build.

The following screen shows the output of building the target called blink.

A screenshot of the build folder after running make on VSCode
The files produced by the build process

You are now ready to copy the .uf2 file onto the pico board.

Flashing the Pico

My pico comes with a lovely cable with a power button on it. This makes it easier to put the board into BOOTSEL mode for accessing it as a flash storage device.

Proceed with the following steps to copy the file onto the pico board.

  1. Open a Finder window

  2. Navigate to any of the build folders within the pico-examples folder

  3. Navigate to the blink folder (assuming you are using my example)

  4. Locate the .uf2 file but don't do anything yet

  5. Hold down the Boot button while connecting the pico to the computer (if you have a power button then this would be the time to turn it on).

  6. Keep holding the Boot button until the pico appears as a drive in your finder window. This takes approximately 3 seconds.

  7. Release the Boot button

  8. copy the uf2 file across to the pico board

The above sequence will cause the board to reboot after flashing the firmware. You should now see the board blinking.

You will get an alert from your OS telling you to eject the device before disconnecting it. There isn't a way of doing that and it's fine because that is the only file you needed to copy across.

Using Arduino IDE

The Arduino IDE provides support for Raspberry Pi Pico along with other RP2040 boards such as the Arduino Nano RP2040 Connect.

If you make use of the Arduino IDE, you will not drag your file across manually. Instead, the IDE will flash the board for you. You also have the benefit of writing your code in Arduino format and making use of their libraries.

Install Board Files

Follow these steps to install the board package.

  1. Open up the Arduino IDE

  2. Go to Tools -> Board -> Boards Manager

  3. Search for "RP2040"

  4. Install the "Arduino Mbed OS RP2040 Boards" package

A screenshot of the Arduino boards manager
Install the RP2040 board package

Select the Pico Board

Use these steps to set the board as the target in the IDE.

  1. Go to Tools -> Board -> Arduino Mbed OS RP2040 Boards

  2. Select Raspberry Pi Pico

A screenshot of the board selection
Choose your board

Open An Example Sketch

Follow these steps to open the example sketch.

  1. Navigate to File -> Examples -> Basics

  2. Select Blink

An example of navigating to the blink sketch
Open the blink sketch

Flash the Sketch

Follow these steps to flash the example sketch onto the pico board.

  1. Verify the sketch using the checkmark on the toolbar

  2. Go to Tools -> Port and confirm that the only thing there is an incoming Bluetooth.

  3. Disconnect the pico board if it's connected to your computer (or turn off the cable switch)

  4. Hold down the Boot button and connect the board (or turn on the cable switch).

  5. Go to Tools -> Port and confirm that you now have a new port. Select this.

  6. Upload the sketch using the button on the toolbar.

The board should now reboot and you should see the onboard LED flashing.

114 views0 comments