Environment variables

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.

PlatformIO handles variables which start with PLATFORMIO_ prefix. They have the HIGHEST PRIORITY.

How to set environment variable?

# Windows
set VARIABLE_NAME=VALUE

# Unix (bash, zsh)
export VARIABLE_NAME=VALUE

# Unix (fish)
set -x VARIABLE_NAME VALUE

General

PlatformIO uses General environment variables for the common operations/commands.

CI

PlatformIO handles CI variable which is setup by Continuous Integration (Travis, Circle and etc.) systems. PlatformIO uses it to disable prompts and progress bars. In other words, CI=true automatically setup PLATFORMIO_DISABLE_PROGRESSBAR to true.

PLATFORMIO_AUTH_TOKEN

Allows to specify Personal Authentication Token that could be used for automatic login in to PIO Account. It is very useful for Continuous Integration systems and PIO Remote operations where you are not able manually authorize.

You can get own Personal Authentication Token using platformio account token command.

PLATFORMIO_FORCE_COLOR

Force to output color ANSI-codes even if the output is a pipe (not a tty). The possible values are true and false. Default is PLATFORMIO_FORCE_COLOR=false.

PLATFORMIO_DISABLE_PROGRESSBAR

Disable progress bar for package/library downloader and uploader. This is useful when calling PlatformIO from subprocess and output is a pipe (not a tty). The possible values are true and false. Default is PLATFORMIO_DISABLE_PROGRESSBAR=false.

PLATFORMIO_HOME_DIR

Allows to override Project Configuration File platformio.ini option home_dir.

PLATFORMIO_INCLUDE_DIR

Allows to override Project Configuration File platformio.ini option include_dir.

PLATFORMIO_SRC_DIR

Allows to override Project Configuration File platformio.ini option src_dir.

PLATFORMIO_LIB_DIR

Allows to override Project Configuration File platformio.ini option lib_dir.

PLATFORMIO_LIBDEPS_DIR

Allows to override Project Configuration File platformio.ini option libdeps_dir.

PLATFORMIO_BUILD_DIR

Allows to override Project Configuration File platformio.ini option build_dir.

PLATFORMIO_DATA_DIR

Allows to override Project Configuration File platformio.ini option data_dir.

PLATFORMIO_TEST_DIR

Allows to override Project Configuration File platformio.ini option test_dir.

PLATFORMIO_BOARDS_DIR

Allows to override Project Configuration File platformio.ini option boards_dir.

PLATFORMIO_REMOTE_AGENT_DIR

Allows to override platformio remote agent start --working-dir.

Building

PLATFORMIO_BUILD_FLAGS

Allows to set Project Configuration File platformio.ini option build_flags.

Examples:

# Unix:
export PLATFORMIO_BUILD_FLAGS=-DFOO
export PLATFORMIO_BUILD_FLAGS=-DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07
export PLATFORMIO_BUILD_FLAGS='-DWIFI_PASS=\"My password\"' '-DWIFI_SSID=\"My ssid name\"'

# Windows:
SET PLATFORMIO_BUILD_FLAGS=-DFOO
SET PLATFORMIO_BUILD_FLAGS=-DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07
SET PLATFORMIO_BUILD_FLAGS='-DWIFI_PASS="My password"' '-DWIFI_SSID="My ssid name"'
PLATFORMIO_SRC_BUILD_FLAGS

Allows to set Project Configuration File platformio.ini option src_build_flags.

PLATFORMIO_SRC_FILTER

Allows to set Project Configuration File platformio.ini option src_filter.

PLATFORMIO_EXTRA_SCRIPTS

Allows to set Project Configuration File platformio.ini option extra_scripts.

PLATFORMIO_LIB_EXTRA_DIRS

Allows to set Project Configuration File platformio.ini option lib_extra_dirs.

Uploading

PLATFORMIO_UPLOAD_PORT

Allows to set Project Configuration File platformio.ini option upload_port.

PLATFORMIO_UPLOAD_FLAGS

Allows to set Project Configuration File platformio.ini option upload_flags.

Settings

Allows to override PlatformIO settings. You can manage them via platformio settings command.

PLATFORMIO_SETTING_AUTO_UPDATE_LIBRARIES

Allows to override setting auto_update_libraries.

PLATFORMIO_SETTING_AUTO_UPDATE_PLATFORMS

Allows to override setting auto_update_platforms.

PLATFORMIO_SETTING_CHECK_LIBRARIES_INTERVAL

Allows to override setting check_libraries_interval.

PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL

Allows to override setting check_platformio_interval.

PLATFORMIO_SETTING_CHECK_PLATFORMS_INTERVAL

Allows to override setting check_platforms_interval.

PLATFORMIO_SETTING_ENABLE_CACHE

Allows to override setting enable_cache.

PLATFORMIO_SETTING_ENABLE_SSL

Allows to override setting enable_ssl.

PLATFORMIO_SETTING_ENABLE_TELEMETRY

Allows to override setting enable_telemetry.

PLATFORMIO_SETTING_FORCE_VERBOSE

Allows to override setting force_verbose.

PLATFORMIO_SETTING_PROJECTS_DIR

Allows to override setting projects_dir.