Configuration - Arduino CLI (original) (raw)

Configuration keys

Configuration methods

Arduino CLI may be configured in three ways:

  1. Command line flags
  2. Environment variables
  3. Configuration file

If a configuration option is configured by multiple methods, the value set by the method highest on the above list overwrites the ones below it.

If a configuration option is not set, Arduino CLI uses a default value.

arduino-cli config dump displays the current configuration values.

Command line flags

Arduino CLI's command line flags are documented in the command line help and the Arduino CLI command reference.

Example

Setting an additional Boards Manager URL using the --additional-urls command line flag:

$ arduino-cli core update-index --additional-urls https://downloads.arduino.cc/packages/package_staging_index.json

Environment variables

All configuration options can be set via environment variables. The variable names start with ARDUINO, followed by the configuration key names, with each component separated by _. For example, the ARDUINO_DIRECTORIES_USER environment variable sets the directories.user configuration option.

On Linux or macOS, you can use the export command to set environment variables. On Windows cmd, you can use the set command.

Example

Setting an additional Boards Manager URL using the ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS environment variable:

$ export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=https://downloads.arduino.cc/packages/package_staging_index.json

Configuration file

arduino-cli config init creates or updates a configuration file with the current configuration settings.

This allows saving the options set by command line flags or environment variables. For example:

arduino-cli config init --additional-urls https://downloads.arduino.cc/packages/package_staging_index.json

File name

The configuration file must be named arduino-cli, with the appropriate file extension for the file's format.

Supported formats

arduino-cli config init creates a YAML file, however a variety of common formats are supported:

Locations

Configuration files in the following locations are recognized by Arduino CLI:

  1. Location specified by the --config-file command line flag
  2. Arduino CLI data directory (as configured by directories.data)

If multiple configuration files are present, the one highest on the above list is used. Configuration files are not combined.

The location of the active configuration file can be determined by running the command:

arduino-cli config dump --verbose

Example

Setting an additional Boards Manager URL using a YAML format configuration file:

board_manager: additional_urls: - https://downloads.arduino.cc/packages/package_staging_index.json

Doing the same using a TOML format file:

[board_manager] additional_urls = [ "https://downloads.arduino.cc/packages/package_staging_index.json" ]

JSON schema

The configuration file JSON schema can be used to independently validate the file content. This schema should be considered unstable in this version.