mpremote Cheatsheet
Quick reference for the most common mpremote commands.
Installation
mpremote is a Python package. You need Python 3 installed first.
Verify it works:
Using a virtual environment (recommended)
If your system Python restricts global installs (error: externally-managed-environment), or you want a clean setup, use a virtual environment:
python -m venv ~/pico-env
source ~/pico-env/bin/activate # Linux/Mac
# ~/pico-env\Scripts\activate # Windows
pip install mpremote
You need to activate the environment each time you open a new terminal:
To make this automatic, add the source line to your ~/.bashrc or ~/.zshrc.
Platform notes:
| OS | Notes |
|---|---|
| Linux | You may need serial port access: sudo usermod -a -G dialout $USER (then log out and back in) |
| macOS | Works out of the box after pip install |
| Windows | Use Command Prompt or PowerShell. If pip is not found, try py -m pip install mpremote |
If you get
command not foundafter installing, make sure your Python scripts directory is on yourPATH, or usepython -m mpremoteinstead.
Connection
# List connected Picos
mpremote connect list
# Connect to specific port
mpremote connect /dev/ttyACM0
# Auto-connect (finds first Pico)
mpremote
Running Code
# Run script (doesn't save to Pico)
mpremote connect /dev/ttyACM0 run script.py
# Interactive REPL
mpremote connect /dev/ttyACM0 repl
REPL Shortcuts:
| Key | Action |
|---|---|
Ctrl+C |
Stop running code |
Ctrl+D |
Soft reset |
Ctrl+X |
Exit mpremote |
File Operations
# List files on Pico (root)
mpremote connect /dev/ttyACM0 ls
# List files in lib folder
mpremote connect /dev/ttyACM0 ls lib/
# Copy file TO Pico (note the colon prefix)
mpremote connect /dev/ttyACM0 cp local.py :remote.py
# Copy file FROM Pico
mpremote connect /dev/ttyACM0 cp :remote.py local.py
# View file contents
mpremote connect /dev/ttyACM0 cat main.py
# Delete file
mpremote connect /dev/ttyACM0 rm main.py
# Create directory
mpremote connect /dev/ttyACM0 mkdir lib
Device Control
# Soft reset (restart)
mpremote connect /dev/ttyACM0 reset
# Hard reset
mpremote connect /dev/ttyACM0 bootloader
Common Workflows
Deploy main.py
Deploy library
Quick test (no save)
Check what's on Pico
Shorthand
If you only have one Pico connected:
Troubleshooting
| Error | Solution |
|---|---|
| "no MicroPython device" | Check USB connection, try different cable |
| "permission denied" | sudo usermod -a -G dialout $USER then logout/login |
| "device busy" | Close Thonny or other serial programs |
| "cannot write" | Pico might be in BOOTSEL mode, reconnect normally |