table of contents
| ARDUINO COMMAND LINE MANUAL(1) | ARDUINO COMMAND LINE MANUAL(1) |
NAME¶
arduino-cli-compile - Compiles Arduino sketches.
SYNOPSIS¶
arduino-cli compile [flags]
DESCRIPTION¶
Compiles Arduino sketches.
OPTIONS¶
--board-options=[] List of board options separated by commas. Or can be used multiple times for multiple options.
--build-path="" Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.
--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.
--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 for compile
-j, --jobs=0 Max number of parallel compiles. If set to 0 the number of available CPUs cores will be used.
--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 except pre* hooks.
--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.: COM3 or /dev/ttyACM2
--preprocess[=false] Print preprocessed code to stdout instead of compiling.
-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.
--show-properties[="disabled"] Show build properties. The properties are expanded, use "--show-properties=unexpanded" if you want them exactly as they are defined.
--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.
-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 (-W flag).
OPTIONS INHERITED FROM PARENT COMMANDS¶
--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.
EXAMPLE¶
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
SEE ALSO¶
HISTORY¶
15-Aug-2026 Auto generated by spf13/cobra
| Aug 2026 | Auto generated by spf13/cobra |