Skip to main content

run

These are the flags/commands under buck2 run and their --help output:

buck run

buck2-release-run 
Build and run the selected target.

The Build ID for the underlying build execution is made available to the target in the
`BUCK_RUN_BUILD_ID` environment variable.

USAGE:
buck2-release run [OPTIONS] <TARGET> [--] [TARGET_ARGS]...

ARGS:
<TARGET>
Target to build and run

<TARGET_ARGS>...
Additional arguments passed to the target when running it

OPTIONS:
--build-report <PATH>
Print a build report

--build-report=- will print the build report to stdout --build-report=<filepath> will
write the build report to the file

--build-report-options <BUILD_REPORT_OPTIONS>
Comma separated list of build report options (currently only supports a single option:
fill-out-failures).

-c, --config <SECTION.OPTION=VALUE>
List of config options

--chdir <CHDIR>
Set the current working directory of the executable being run

--client-metadata <CLIENT_METADATA>
Metadata key-value pairs to inject into Buck2's logging. Client metadata must be of the
form `key=value`, where `key` is a snake_case identifier, and will be sent to backend
datasets

--command-args-file <COMMAND_ARGS_FILE>
Write the command to a file instead of executing it.

--config-file <PATH>
List of config file paths

--console <super|simple|...>
Which console to use for this command

[env: BUCK_CONSOLE=]
[default: auto]
[possible values: simple, simplenotty, simpletty, super, auto, none]

--disable-starlark-types
Disable runtime type checking in Starlark interpreter.

This option is not stable, and can be used only locally to diagnose evaluation
performance problems.

--eager-dep-files
Process dep files when they are generated (i.e. after running a command that produces
dep files), rather than when they are used (i.e. before re-running a command that
previously produced dep files). Use this when debugging commands that produce dep files.
Note that commands that previously produced dep files will not re-run: only dep files
produced during this command will be eagerly loaded

--emit-shell
Instead of running the command, print out the command formatted for shell interpolation,
use as: $(buck2 run --emit-shell ...)

--event-log <PATH>
Write events to this log file

--exit-when-different-state
Used for exiting a concurrent command when a different state is detected

--fail-fast
If Buck hits an error, do as little work as possible before exiting.

To illustrate the effect of this flag, consider an invocation of `build :foo :bar`. The
default behavior of buck is to do enough work to get a result for the builds of each of
`:foo` and `:bar`, and no more. This means that buck will continue to complete the build
of `:bar` after the build of `:foo` has failed; however, once one dependency of `:foo`
has failed, other dependencies will be cancelled unless they are needed by `:bar`.

This flag changes the behavior of buck to not wait on `:bar` to complete once `:foo` has
failed. Generally, this flag only has an effect on builds that specify multiple targets.

`--keep-going` changes the behavior of buck to not only wait on `:bar` once one
dependency of `:foo` has failed, but to additionally attempt to build other dependencies
of `:foo` if possible.

--fake-arch <ARCH>
[possible values: default, aarch64, x8664]

--fake-host <HOST>
[possible values: default, linux, macos, windows]

--fake-xcode-version <VERSION-BUILD>
Value must be formatted as: version-build (e.g., 14.3.0-14C18 or 14.1-14B47b)

-h, --help
Print help information

-j, --num-threads <THREADS>
Number of threads to use during execution (default is # cores)

--keep-going
If Buck hits an error, continue doing as much work as possible before exiting.

See `--fail-fast` for more details.

--local-only
Enable only local execution. Will reject actions that cannot execute locally

[env: BUCK_OFFLINE_BUILD=]

-m, --modifier <VALUE>
A configuration modifier to configure all targets on the command line. This may be a
constraint value target.

--materialize-failed-inputs
Materializes inputs for failed actions which ran on RE

--no-interactive-console
Disable console interactions

[env: BUCK_NO_INTERACTIVE_CONSOLE=]

--no-remote-cache
Do not perform remote cache queries or cache writes. If remote execution is enabled, the
RE service might still deduplicate actions, so for e.g. benchmarking, using a random
isolation dir is preferred

[env: BUCK_OFFLINE_BUILD=]

--oncall <ONCALL>
The oncall executing this command

--prefer-local
Enable hybrid execution. Will prefer executing actions that can execute locally on the
local host

--prefer-remote
Enable hybrid execution. Will prefer executing actions that can execute remotely on RE
and will avoid racing local and remote execution

--remote-only
Enable only remote execution. Will reject actions that cannot execute remotely

--reuse-current-config
Re-uses any `--config` values (inline or via modefiles) if there's a previous command,
otherwise the flag is ignored.

If there is a previous command and `--reuse-current-config` is set, then the old config
is used, ignoring any overrides.

If there is no previous command but the flag was set, then the flag is ignored, the
command behaves as if the flag was not set at all.

--skip-incompatible-targets
If target is incompatible with the specified configuration, skip building instead of
throwing error. This does not apply to targets specified with glob patterns `/...` or
`:` which are skipped unconditionally

--skip-missing-targets
If target is missing, then skip building instead of throwing error

--skip-targets-with-duplicate-names
If there are targets with duplicate names in `BUCK` file, skip all the duplicates but
the first one. This is a hack for TD. Do not use this option

--stack
Record or show target call stacks.

Starlark call stacks will be included in duplicate targets error.

If a command outputs targets (like `targets` command), starlark call stacks will be
printed after the targets.

--target-platforms <PLATFORM>
Configuration target (one) to use to configure targets

--ui <UI>
Configure additional superconsole ui components.

Accepts a comma-separated list of superconsole components to add. Possible values are:

dice - shows information about evaluated dice nodes debugevents - shows information
about the flow of events from buckd

These components can be turned on/off interactively. Press 'h' for help when
superconsole is active.

[possible values: dice, debugevents, io, re]

--unstable-no-execution
Experimental: Disable all execution

--unstable-write-invocation-record <PATH>
Write the invocation record (as JSON) to this path. No guarantees whatsoever are made
regarding the stability of the format

--upload-all-actions
Uploads every action to the RE service, regardless of whether the action needs to
execute on RE.

This is useful when debugging builds and trying to inspect actions which executed
remotely. It's possible that the action result is cached but the action itself has
expired. In this case, downloading the action itself would fail. Enabling this option
would unconditionally upload all actions, thus you will not hit any expiration issues.

-v, --verbose <VERBOSITY>
How verbose buck should be while logging.

Values: 0 = Quiet, errors only; 1 = Show status. Default; 2 = more info about errors; 3
= more info about everything; 4 = more info about everything + stderr;

It can be combined with specific log items (stderr, full_failed_command, commands,
actions, status, stats, success) to fine-tune the verbosity of the log. Example usage
"-v=1,stderr"

[default: 1]

--write-build-id <PATH>
Write command invocation id into this file

--write-to-cache-anyway
Could be used to enable the action cache writes on the RE worker when no_remote_cache is
specified