Photo by Vishnu Mohanan

Uploading to the Raspberry Pi Pico without Thonny

Thonny is the recommended way of working with a Pico and MicroPython as it has built-in support for running and uploading files. However, I wanted to use Visual Studio Code as my code editor and upload files via the command line instead. I found two CLI tools that I could use to achieve this: rshell and ampy.


rshell provides a shell that runs on the Pico. It can be downloaded using pip:

To connect to the Pico:

Where ttyXXXXis the serial port that your Pico is connected to. You can find the serial port by running ls /dev/tty*with the board disconnected, and then connected, and compare the results. If the output is hard to compare, redirect it to a text file (e.g. ls /dev/tty* >> connected.txt) and then use diff to compare the files. On my Mac, the Pico’s serial port is currently /dev/tty.usbmodem000000000001 but this might not be the same for you so make sure to check first!

The files for the Pico are stored in /pyboard. Once rshell has connected, you can see what files are on the Pico by running ls /pyboard . You can copy a local file to the Pico with cp /pyboard. If you want the python file to run when the Pico is powered on, make sure the file is named

To exit the shell, type exit.


ampy is a CLI tool for manipulating files and running code on a MicroPython board, such as the Pico, over a serial connection. It’s the tool that I find myself using most and it can be also installed via pip:

To list files on the board (see the discussion above on how to find out your serial port):

To run a file on the board without uploading it:

To upload a file:

To remove a file:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store