CLI for controlling BambuLab printers directly over MQTT/FTPS/camera.
go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@latestIf @latest resolves to an older commit, use:
GOPROXY=direct go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@masteror pin a commit:
GOPROXY=direct go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@<commit># 1) Install Go (if needed)
brew install go
# 2) Install babu-cli
go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@latest
# 3) Add Go bin to PATH
echo 'export PATH="$PATH:$(go env GOPATH)/bin"' >> ~/.zshrc
source ~/.zshrc
hash -r
# 4) Verify
which babu-cli
babu-cli --helpIf you use GOBIN, add that path instead of $(go env GOPATH)/bin.
Download the latest release from GitHub Releases and extract the binary for your platform.
go build -o babu-cli ./cmd/babu-cliWhen a new feature is pushed, update babu-cli using the same method you used to install it.
macOS:
go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@latest
hash -r
babu-cli --helpWindows (PowerShell):
go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@latest
Get-Command babu-cli
babu-cli --helpIf @latest resolves to an older commit, use:
macOS/Linux:
GOPROXY=direct go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@masterWindows (PowerShell):
$env:GOPROXY = "direct"
go install github.com/Dev-devadath/babu-cli/cmd/babu-cli@master- Download the newest archive from GitHub Releases.
- Extract it.
- Replace your existing
babu-clibinary (babu-cli.exeon Windows) in yourPATH. - Open a new terminal and run:
babu-cli --help# Create a working default profile (uses profile name "default")
babu-cli config set \
--ip 192.168.1.200 \
--serial AC12309BH109 \
--access-code YOUR_ACCESS_CODE
# Optional: use a named profile
babu-cli config set --printer lab \
--ip 192.168.1.200 \
--serial AC12309BH109 \
--access-code YOUR_ACCESS_CODE \
--default
# Status
babu-cli status
# Start a print
babu-cli print start ./benchy.3mf --plate 1# List files on printer storage
babu-cli files list
babu-cli files list --dir cache
# Upload local file to printer storage
babu-cli files upload ./benchy.3mf
babu-cli files upload ./benchy.3mf --as cache/benchy.3mf
# Download file from printer storage
babu-cli files download cache/benchy.3mf --out ./benchy-copy.3mf
# Delete file from printer storage
babu-cli files delete cache/benchy.3mf# Start print from local file (uploads first, then starts)
babu-cli print start ./benchy.3mf --plate 1
# Start print from file already on printer (no upload)
babu-cli print start --no-upload --plate 1 "cache/benchy.3mf"
# Print controls
babu-cli print pause
babu-cli print resume
babu-cli print stopNotes:
- Use
.3mfforprint start --no-upload. - Keep flags before the filename (for example:
print start --no-upload --plate 1 "file.3mf"). --plate 1maps toMetadata/plate_1.gcodeinside the 3MF.
- User config:
<os.UserConfigDir>/bambu/config.json- macOS usually:
~/Library/Application Support/bambu/config.json - Linux usually:
~/.config/bambu/config.json - Windows usually:
%AppData%\bambu\config.json
- macOS usually:
- Project config:
./.bambu.json - Precedence: flags > env > project config > user config
- Missing config file is treated as empty; it is created on first
config set.
babu-cli expects default_profile + profiles. Example:
{
"default_profile": "lab",
"profiles": {
"lab": {
"ip": "192.168.11.234",
"serial": "0300DA610705389",
"access_code": "YOUR_ACCESS_CODE"
}
}
}Note: configs using machines, token, etc. are from other tools and are not read by babu-cli.
Get the printer access code from the device or Bambu Studio, then set it directly:
babu-cli config set --ip 192.168.1.200 --serial AC12309BH109 --access-code YOUR_ACCESS_CODEOr use a file if you prefer:
mkdir -p ~/.config/bambu
printf "%s" "YOUR_ACCESS_CODE" > ~/.config/bambu/lab.code
chmod 600 ~/.config/bambu/lab.codeIn Bambu Studio on macOS: open the Device view for your printer, open its settings, and look for "LAN Access" or "Access Code" (often shown alongside IP/serial details).
BAMBU_PROFILEBAMBU_IPBAMBU_SERIALBAMBU_ACCESS_CODEBAMBU_ACCESS_CODE_FILEBAMBU_TIMEOUTBAMBU_NO_CAMERABAMBU_MQTT_PORTBAMBU_FTP_PORTBAMBU_CAMERA_PORT
go install likely succeeded but your shell PATH does not include Go bin.
go env GOBIN
go env GOPATH
ls -l "$(go env GOPATH)/bin" | grep babu-cliThen add the correct bin path to PATH in ~/.zshrc.
This means no access code source was resolved for the active profile.
Resolution order:
--access-code-stdin--access-code-fileBAMBU_ACCESS_CODEBAMBU_ACCESS_CODE_FILEprofiles.<name>.access_codeprofiles.<name>.access_code_file
Profile selection order:
--printerBAMBU_PROFILEdefault_profile
Set it explicitly:
babu-cli config set --ip 192.168.1.200 --serial AC12309BH109 --access-code YOUR_ACCESS_CODEIf the job starts heating/extruding and then pauses with filament-related prompts, check AMS mode.
- Default behavior is
--ams auto.- If AMS is not detected, the print starts with
use_ams=false. - If AMS is detected, the CLI tries to auto-select loaded tray IDs for
ams_mapping.
- If AMS is not detected, the print starts with
- Use
--ams onto force AMS mode (optionally with--ams-mapping). - Use
--ams offor--no-amsto disable AMS for that print.
Use --no-ams only when printing from an external spool/manual feed path that matches your loaded filament.
- Printer must be reachable on ports 8883 (MQTT), 990 (FTPS), 6000 (camera).
access_codeis stored as plain text in config when set directly.