ARDUINO-CLI-COMPILE(1)
π ARDUINO-CLI-COMPILE(1) π
okay bestie, welcome to the Arduino Command Line Manual β yes, that's the whole manual name, she's fancy like that. we're talking about arduino-cli-compile today and honestly? she's the main character of your whole build process. let's get into it π«Ά
β¨ NAME β¨
arduino-cli-compile β Compiles Arduino sketches.
like. that's it. that's her job. she compiles Arduino sketches. no cap.
πΈ SYNOPSIS πΈ
arduino-cli compile [flags]
π¦ DESCRIPTION π¦
Compiles Arduino sketches.
(it's giving "short and confident". iconic behavior honestly. don't overthink it, just know that when you type compile, your sketch is getting turned into something your board can actually run π
)
π OPTIONS π
okay this is the big one. buckle up, there's a LOT, but every single one of them is useful so let's go:
--board-options=[]β a list of board options separated by commas. or you can hit her with it multiple times for multiple options, whatever vibes β¨--build-path=""β where to save the compiled files. if you leave it empty, a directory gets created in the default temporary path of your OS. lowkey convenient π--build-property=[]β override a build property with a custom value. can be used multiple times for multiple properties.--clean[=false]β optional; cleanup the build folder and do not use any cached build. full fresh start energy π§--discovery-timeout=1sβ max time to wait for port discovery. e.g.:30s,1m--dump-profile[=false]β create and print a profile configuration from the build.--encrypt-key=""β the name of the custom encryption key to use to encrypt a binary during the compile process. used only by the platforms that support it π«‘-e,--export-binaries[=false]β if set, built binaries will be exported to the sketch folder.-b,--fqbn=""β Fully Qualified Board Name, e.g.:arduino:avr:uno-h,--help[=false]β help forcompile-j,--jobs=0β max number of parallel compiles. if set to0, the number of available CPUs cores will be used. let her cook π₯--keys-keychain=""β the path of the dir to search for the custom keys to sign and encrypt a binary. used only by the platforms that support it.--libraries=[]β path to a collection of libraries. can be used multiple times, or entries can be comma separated.--library=[]β path to a single library's root folder. can be used multiple times, or entries can be comma separated.--only-compilation-database[=false]β just produce the compilation database, without actually compiling. all build commands are skipped exceptpre*hooks. iykyk--optimize-for-debug[=false]β optional; optimize compile output for debugging rather than for release.--output-dir=""β save build artifacts in this directory.-p,--port=""β upload port address, e.g.:COM3or/dev/ttyACM2--preprocess[=false]β print preprocessed code to stdout instead of compiling. π just looking, not touching-m,--profile=""β sketch profile to use-P,--programmer=""β programmer to use, e.g:atmel_ice-l,--protocol=""β upload port protocol, e.g:serial-q,--quiet[=false]β optional; suppresses almost every output. (almost!! not all!! π)--show-properties[="disabled"]β show build properties. the properties are expanded, so use"--show-properties=unexpanded"if you want them exactly as they are defined. picky queen behavior and we respect it π--sign-key=""β the name of the custom signing key to use to sign a binary during the compile process. used only by the platforms that support it.-u,--upload[=false]β upload the binary after the compilation.-v,--verbose[=false]β optional; turns on verbose mode. she will tell you EVERYTHING π-t,--verify[=false]β verify uploaded binary after the upload.--warnings="none"β optional; can be:none,default,more,all. used to tell gcc which warning level to use (-Wflag).
π OPTIONS INHERITED FROM PARENT COMMANDS π
these ones come from the parent command arduino-cli β she shares her toys, so cute:
--additional-urls=[]β comma-separated list of additional URLs for the Boards Manager.--config-dir=""β sets the default data directory (Arduino CLI will look for configuration file in this directory).--config-file=""β the custom config file (if not specified the default will be used).--json[=false]β print the output in JSON format.--log[=false]β print the logs on the standard output.--log-file=""β path to the file where logs will be written.--log-format="text"β the output format for the logs, can be:text,json--log-level="info"β messages with this level and above will be logged. valid levels are:trace,debug,info,warn,error,fatal,panic--no-color[=false]β disable colored output. π (why would you. but okay. valid.)
β EXAMPLE β
here's how the girlies actually run her, verbatim, no edits:
debian/build/bin/arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch
debian/build/bin/arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=\"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
debian/build/bin/arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=-DPIN=2 \"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
debian/build/bin/arduino-cli compile -b arduino:avr:uno --build-property build.extra_flags=-DPIN=2 --build-property "compiler.cpp.extra_flags=\"-DSSID=\"hello world\"\"" /home/user/Arduino/MySketch
like yes, those quotes are doing gymnastics. yes, they're correct. that's just how it eats π
π SEE ALSO π
go read her too, she's the parent, she's got the lore πΈ
π HISTORY π
15-Aug-2026 β Auto generated by spf13/cobra
and that's the whole page bestie!! π this manual page belongs to the Arduino Command Line Manual, auto generated by spf13/cobra, dated Aug 2026 β so if you ever forget where all this came from, it's cobra's baby, and it's adorable. now go compile something iconic πβ¨π
π¦ where this page comes from
- ubuntu stonking: arduino-cli 1.5.1-4 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms