vix run
vix run builds and runs something with Vix.
It can run a Vix project, a single C++ file, a .vix manifest, a compiled binary, a container image, an SSH target, or an HTTP target.
Use it when you want one command that prepares a target and starts it immediately.
vix runOverview
vix run is the general execution command in Vix.
It is not limited to web applications.
It can run:
- the current project
- a named project or target
- a
vix.appproject - a CMake project
- a single C++ file
- a
.vixmanifest - a compiled binary
- a Docker image
- a container image
- an SSH target
- an HTTP or HTTPS target
- Vix umbrella examples
It is useful when you want to start something manually without entering the continuous development loop of vix dev.
For active development with automatic reload, use vix dev or vix run --watch.
Usage
vix run [target] [options] [-- compiler/linker flags] [--run <args...>]The target is optional.
If no target is provided, Vix tries to run the current project.
vix runSupported targets
| Target | Mode | Example |
|---|---|---|
| No target | Current project | vix run |
| Project directory or target name | Project mode | vix run api |
| Single C++ file | Script mode | vix run main.cpp |
.vix manifest | Manifest mode | vix run app.vix |
| Binary | Binary mode | vix run ./app |
| Docker image | Runtime target | vix run docker://nginx |
| Container image | Runtime target | vix run container://nginx |
| SSH target | Runtime target | vix run ssh://user@host |
| HTTP target | Runtime target | vix run https://example.com |
| Vix umbrella example | Example mode | vix run example main |
Basic examples
# Run the current project
vix run
# Run a named project or target
vix run api
# Run a project from another directory
vix run --dir ./examples/blog
# Run a single C++ file
vix run main.cpp
# Run a .vix manifest
vix run app.vix
# Run a compiled binary
vix run ./app
# Run a Docker image
vix run docker://nginx -p 8080:80
# Run a container image
vix run container://nginx -p 8080:80
# Run a remote SSH command
vix run ssh://localhost echo hello
# Fetch an HTTP target
vix run https://example.com2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
What vix run does
When you run:
vix runVix performs the needed steps:
- Parse the command.
- Detect the target type.
- Resolve the project, file, manifest, binary, or runtime target.
- Configure the project when needed.
- Build the target when needed.
- Resolve the executable when needed.
- Apply runtime environment variables.
- Start the target.
- Stream output live.
- Capture build or runtime failures.
- Print Vix diagnostics when possible.
The goal is simple:
one command
correct target resolution
clear runtime behavior
better diagnostics when something fails2
3
4
Target resolution
vix run resolves targets in a practical order.
If a target is provided and starts with one of these prefixes, Vix treats it as a runtime target:
docker://
container://
ssh://
http://
https://2
3
4
5
If a target is a file, Vix checks whether it is:
- a
.cppfile - an executable binary
- a
.vixmanifest
If a target is a directory, Vix treats it as a project directory.
If no target is provided, Vix tries to use:
.vix/meta.json last_binary
CMakeLists.txt
vix.app
local executable in the current folder2
3
4
If none of these can be resolved, Vix reports that it cannot determine what to run.
Project mode
Project mode is used when Vix runs a project.
A project can be based on:
CMakeLists.txt
vix.app2
Run the current project:
vix runRun a named target or project:
vix run apiRun from another directory:
vix run --dir ./apps/apiProject mode can:
- resolve the project root
- detect
CMakeLists.txtorvix.app - configure the project when needed
- build the selected target
- find the resulting executable
- run it with runtime arguments and environment variables
CMake and vix.app project resolution
Vix respects this project resolution order:
1. CMakeLists.txt
2. vix.app2
If both files exist, Vix uses CMakeLists.txt.
That keeps full CMake projects in control.
If no CMakeLists.txt exists but vix.app exists, Vix uses the vix.app project.
For vix.app, Vix can generate an internal CMake project and then build it.
The user still runs:
vix runPreset-based project runs
For projects with CMake presets, Vix can use the preset flow.
vix run api --preset dev-ninja
vix run api --preset release2
You can also select a run preset:
vix run api --run-preset run-dev-ninjaClean project run
Use --clean when you want to clean or reconfigure before running.
vix run --clean
vix run api --clean2
Parallel build jobs
Use -j or --jobs to control build parallelism.
vix run api -j 8
vix run api --jobs 162
Script mode
Script mode is used when the target is a single .cpp file.
vix run main.cppVix treats the file as a runnable C++ script.
This is useful for:
- quick experiments
- small examples
- learning
- temporary tools
- small HTTP servers
- local scripts
- testing Vix APIs without creating a full project
Direct script compilation
For simple scripts, Vix can use direct compilation.
vix run main.cppThe idea is:
main.cpp
-> compile
-> link
-> run2
3
4
The user does not need to create:
CMakeLists.txt
vix.app2
CMake fallback for scripts
Some scripts need more than direct compilation, for example scripts that use Vix runtime features, special dependencies, database support, or sanitizer modes.
Vix handles this automatically. You still run the same command:
vix run server.cppVix decides whether to use direct compilation or CMake fallback.
Script cache
Vix can cache script builds.
If nothing relevant changed, repeated runs can reuse the previous result.
Use local script cache when you want the cache to stay local to the current working directory:
vix run main.cpp --local-cacheAuto dependencies
Use --auto-deps to add include paths from installed local Vix dependencies.
vix run main.cpp --auto-depsEquivalent local form:
vix run main.cpp --auto-deps=localSearch dependencies in parent folders too:
vix run main.cpp --auto-deps=upThis is useful when a script depends on packages installed under .vix/deps.
Script compiler and linker flags
In script mode, everything after -- is treated as compiler or linker flags.
vix run main.cpp -- -O2 -DNDEBUGAdd include paths:
vix run main.cpp -- -I./includeAdd library paths:
vix run main.cpp -- -L./libLink libraries:
vix run main.cpp -- -lssl -lcryptoCombine flags:
vix run main.cpp -- -O2 -I./include -L./lib -lmylibRuntime arguments
Runtime arguments are arguments passed to the program being executed.
For project mode, use repeated --args:
vix run api --args --port --args 8080For script mode, prefer --run:
vix run main.cpp --run --port 8080You can also use repeated --args in script mode:
vix run main.cpp --args input.txt --args output.txtImportant script argument rule
In script mode, -- is for compiler or linker flags.
Do not use it for runtime arguments.
Wrong:
vix run main.cpp -- --port 8080Correct:
vix run main.cpp --run --port 8080Or:
vix run main.cpp --args --port --args 8080Compiler flags and runtime args together
Use -- for compiler or linker flags, then --run for program arguments.
vix run main.cpp -- -O2 -DNDEBUG --run hello 123Here:
-O2 -DNDEBUGgo to the compiler.
hello 123go to the program.
Manifest mode
Manifest mode is used when the target is a .vix manifest.
vix run app.vixThe manifest is loaded first.
Then command-line options are merged on top.
Depending on the manifest, Vix may behave like script mode or project mode.
Examples:
vix run app.vix
vix run app.vix --env APP_ENV=dev
vix run app.vix --args --port --args 80802
3
Binary mode
If the target is an executable binary, Vix can run it directly.
vix run ./appYou can pass runtime arguments:
vix run ./app --args --port --args 8080You can pass environment variables:
vix run ./app --env APP_ENV=devYou can set the working directory:
vix run ./app --cwd ./runtimeVix still applies its runtime environment handling and diagnostics where possible.
Docker and container targets
vix run can run container targets on supported Unix-like systems.
Docker image:
vix run docker://nginxContainer image:
vix run container://nginxPass Docker runtime arguments after the target:
vix run docker://nginx -p 8080:80This maps to a Docker run flow similar to:
docker run -it --rm -p 8080:80 nginxContainer runtime targets are not supported on Windows yet.
SSH targets
vix run can execute an SSH target.
vix run ssh://user@hostPass a remote command:
vix run ssh://localhost echo helloThis maps to an SSH command similar to:
ssh localhost echo helloUse this when you want Vix to dispatch a simple runtime target through SSH.
HTTP and HTTPS targets
vix run can run an HTTP or HTTPS target.
vix run http://example.com
vix run https://example.com2
On supported systems, this uses a curl -L style request.
You can pass additional arguments:
vix run https://example.com -IThis is useful for quick HTTP checks from the same runtime command surface.
Vix umbrella examples
Inside the Vix umbrella repository, examples can be run with:
vix run example main
vix run example now_server2
If the example binary exists in the build directory, Vix runs it.
If it does not exist, Vix reports that the example binary was not found and tells you to make sure the example is enabled and built.
Library projects and test binaries
Some projects are libraries and do not produce a main executable.
When Vix cannot find a main executable, it can detect a single test binary in the build directory and run it.
This allows a library project to still have a useful vix run behavior when a single test binary is available.
Working directory
Use --cwd to run the program from a specific working directory.
vix run api --cwd ./runtime
vix run main.cpp --cwd ./data
vix run ./app --cwd ./runtime2
3
This is useful when your program expects files relative to a specific runtime folder.
Environment variables
Use --env to add or override environment variables for the running program.
vix run api --env APP_ENV=dev
vix run api --env APP_ENV=dev --env PORT=8080
vix run server.cpp --env PORT=80802
3
Each --env accepts one KEY=value pair.
Watch mode
Use --watch to rebuild and restart when files change.
vix run api --watch
vix run server.cpp --watch2
--reload is an alias-style flag for watch behavior:
vix run api --reloadForce server behavior:
vix run server.cpp --force-server --watchForce script behavior:
vix run tool.cpp --force-scriptFor active development, prefer:
vix devvix dev is optimized for the development loop.
Server and script classification
Vix tries to decide whether a program is a long-running server or a short-lived script.
You can force the classification.
Treat the program as a server:
vix run server.cpp --force-serverTreat the program as a short-lived script:
vix run tool.cpp --force-scriptThis matters for watch mode, restart behavior, and runtime output handling.
Sanitizers
Vix can run script builds with sanitizers.
Enable AddressSanitizer and UBSan:
vix run main.cpp --sanEnable UBSan only:
vix run main.cpp --ubsanEnable ThreadSanitizer:
vix run main.cpp --tsanSanitizers are useful for detecting memory errors, undefined behavior, and threading issues.
Database support in script mode
Enable SQLite support:
vix run main.cpp --with-sqliteEnable MySQL support:
vix run main.cpp --with-mysqlThese options are useful when a single-file script needs database-related Vix support.
OpenAPI docs mode
vix run keeps OpenAPI/docs disabled by default.
vix run apiThis sets:
VIX_DOCS=0Enable docs for one run:
vix run api --docsThis sets:
VIX_DOCS=1Disable docs explicitly:
vix run api --no-docsYou can also pass an explicit value:
vix run api --docs=true
vix run api --docs=false
vix run api --docs=1
vix run api --docs=02
3
4
The CLI option is preferred because it makes the current run explicit.
You can also use the environment variable:
VIX_DOCS=1 vix run api
VIX_DOCS=0 vix run api2
Replay recording
Use --replay to record a run under .vix/runs/.
vix run api --replay
vix run main.cpp --replay
vix run ./app --replay2
3
Recorded runs can later be inspected or replayed with:
vix replay list
vix replay last
vix replay show <id>
vix replay failed2
3
4
Use replay when you want to reproduce a failed, crashed, or unexpected execution without guessing the original command.
Logging
Set the log level:
vix run api --log-level debugUse verbose mode:
vix run api --verboseUse quiet mode:
vix run api --quietSupported log levels:
trace
debug
info
warn
error
critical
off2
3
4
5
6
7
--verbose is an alias for debug-style output.
--quiet reduces output to warnings and errors.
Log format
Set the log format:
vix run api --log-format kv
vix run api --log-format json
vix run api --log-format json-pretty2
3
Log color
Control colored output:
vix run api --log-color auto
vix run api --log-color always
vix run api --log-color never2
3
Disable colors:
vix run api --no-color--no-color is an alias for:
--log-color=neverTerminal clearing
Control terminal clearing:
vix run api --clear=auto
vix run api --clear=always
vix run api --clear=never2
3
Disable clearing:
vix run api --no-clear--no-clear is equivalent to:
--clear=neverOutput behavior
vix run streams program output live.
When possible, it also improves errors from:
- compiler failures
- linker failures
- CMake configure failures
- runtime crashes
- sanitizer reports
- uncaught exceptions
- memory errors
- thread errors
- known C++ runtime mistakes
Instead of showing only raw logs, Vix tries to show:
what failed
where it failed
the relevant code frame
a focused hint
the original output when needed2
3
4
5
Runtime diagnostics
When a program fails at runtime, Vix can detect common failure families such as:
- segmentation faults
- aborts
- uncaught exceptions
- double free
- invalid free
- use after free
- buffer overflow
- null pointer errors
- out-of-range access
- iterator invalidation
- mutex errors
- condition variable errors
- thread lifecycle errors
string_viewlifetime issues- span access issues
- sanitizer reports
The goal is not to hide C++.
The goal is to make C++ failures easier to understand.
Build diagnostics
When compilation fails, Vix tries to format the error clearly.
Example shape:
✖ Build failed
location:
/path/to/file.cpp:line:column
error:
message
code:
line | source code
| marker
hint:
focused suggestion2
3
4
5
6
7
8
9
10
11
12
13
14
If Vix cannot classify the error, it still shows the raw compiler or build output.
Environment variables
| Variable | Description |
|---|---|
VIX_DOCS | Enables or disables OpenAPI/docs mode. |
VIX_LOG_LEVEL | Runtime log level. |
VIX_LOG_FORMAT | Runtime log format. |
VIX_COLOR | Color mode. |
NO_COLOR | Disables colors. |
VIX_STDOUT_MODE | Used by Vix for smoother live output. |
VIX_CLI_CLEAR | Terminal clear behavior. |
VIX_MODE | Runtime mode set by Vix when not already set. |
VIX_SHOW_ENV_HINT | When set to 1, shows a hint if .env.example exists but .env is missing. |
VIX_RUN_UI | Enables the run progress UI when set. |
Options
| Option | Description |
|---|---|
-d, --dir <path> | Project directory. |
--dir=<path> | Same as --dir <path>. |
--preset <name> | Configure or build preset. Default is usually dev-ninja. |
--preset=<name> | Same as --preset <name>. |
--run-preset <name> | Run preset name. |
--run-preset=<name> | Same as --run-preset <name>. |
-j, --jobs <n> | Number of parallel build jobs. |
--jobs=<n> | Same as --jobs <n>. |
--clean | Clean or reconfigure before running. |
--replay | Record this run under .vix/runs/. |
--cwd <path> | Run the program from this working directory. |
--cwd=<path> | Same as --cwd <path>. |
--env <K=V> | Add or override one environment variable. Repeatable. |
--env=<K=V> | Same as --env <K=V>. |
--args <value> | Add one runtime argument. Repeatable. |
--args=<value> | Same as --args <value>. |
--run <args...> | Runtime arguments for script mode. |
--watch | Rebuild and restart on file changes. |
--reload | Alias-style flag for watch behavior. |
--force-server | Treat the program as a long-running server. |
--force-script | Treat the program as a short-lived script. |
--auto-deps | Auto-add includes from .vix/deps/*/include. |
--auto-deps=local | Same as --auto-deps. |
--auto-deps=up | Search dependencies in parent folders too. |
--san | Enable AddressSanitizer and UBSan where supported. |
--ubsan | Enable UBSan only where supported. |
--tsan | Enable ThreadSanitizer where supported. |
--with-sqlite | Enable SQLite support for script mode. |
--with-mysql | Enable MySQL support for script mode. |
--local-cache | Use local script cache. |
--docs | Enable OpenAPI/docs for this run. |
--no-docs | Disable OpenAPI/docs for this run. |
--docs=<0|1|true|false> | Explicitly control OpenAPI/docs mode. |
--clear <auto|always|never> | Clear terminal before runtime output. |
--clear=<auto|always|never> | Same as --clear <mode>. |
--no-clear | Alias for --clear=never. |
--log-level <level> | Set log level. |
--log-level=<level> | Same as --log-level <level>. |
--verbose | Alias for debug logging. |
-q, --quiet | Reduce output to warnings and errors. |
--log-format <format> | Set log format: kv, json, or json-pretty. |
--log-format=<format> | Same as --log-format <format>. |
--log-color <mode> | Set color mode: auto, always, or never. |
--log-color=<mode> | Same as --log-color <mode>. |
--no-color | Alias for --log-color=never. |
-h, --help | Show command help. |
-- <flags...> | In script mode, pass compiler or linker flags. |
Project examples
# Run current project
vix run
# Run named target
vix run api
# Run with project directory
vix run --dir ./apps/api
# Run with preset
vix run api --preset release
# Run with clean configure/build
vix run api --clean
# Run with parallel jobs
vix run api -j 8
# Run with runtime arguments
vix run api --args --port --args 8080
# Run with environment variables
vix run api --env APP_ENV=dev --env PORT=8080
# Run from a specific working directory
vix run api --cwd ./runtime
# Run with watch mode
vix run api --watch
# Record the run
vix run api --replay2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Script examples
# Run a single C++ file
vix run main.cpp
# Run with runtime arguments
vix run main.cpp --run input.txt output.txt
# Run with repeatable runtime arguments
vix run main.cpp --args input.txt --args output.txt
# Run with compiler flags
vix run main.cpp -- -O2 -DNDEBUG
# Run with include path
vix run main.cpp -- -I./include
# Run with linked libraries
vix run main.cpp -- -lssl -lcrypto
# Run with auto dependencies
vix run main.cpp --auto-deps
# Run with local cache
vix run main.cpp --local-cache
# Run with sanitizers
vix run main.cpp --san
vix run main.cpp --ubsan
vix run main.cpp --tsan
# Run with database support
vix run main.cpp --with-sqlite
vix run main.cpp --with-mysql
# Run as a server
vix run server.cpp --force-server
# Run as a server with watch mode
vix run server.cpp --force-server --watch
# Run as a short-lived script
vix run tool.cpp --force-script2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Manifest examples
# Run manifest
vix run app.vix
# Run manifest with environment
vix run app.vix --env APP_ENV=dev
# Run manifest with runtime args
vix run app.vix --args --port --args 80802
3
4
5
6
7
8
Binary examples
# Run a binary
vix run ./app
# Run a binary with arguments
vix run ./app --args --port --args 8080
# Run a binary with environment
vix run ./app --env APP_ENV=dev2
3
4
5
6
7
8
Runtime target examples
# Run Docker image
vix run docker://nginx
# Run Docker image with port mapping
vix run docker://nginx -p 8080:80
# Run container image
vix run container://nginx
# Run SSH target
vix run ssh://localhost echo hello
# Run HTTP target
vix run http://example.com
# Run HTTPS target
vix run https://example.com2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Common workflows
Run the current project
vix runRun a project from another directory
vix run --dir ./apps/apiRun a single C++ file
vix run main.cppRun a server file
vix run server.cpp --force-serverRun a CLI tool file
vix run tool.cpp --force-scriptRun with app arguments
Project:
vix run api --args --port --args 8080Script:
vix run main.cpp --run --port 8080Run with compiler flags
vix run main.cpp -- -O2 -DNDEBUGRun with linked libraries
vix run main.cpp -- -lssl -lcryptoRun with watch mode
vix run api --watchRun with sanitizers
vix run main.cpp --sanRun with debug logs
vix run api --log-level debug
VIX_LOG_LEVEL=debug vix run api2
Run with OpenAPI docs enabled
vix run api --docsBy default, OpenAPI/docs are disabled:
vix run apiCommon mistakes
Passing runtime args after -- in script mode
Wrong:
vix run main.cpp -- --port 8080Correct:
vix run main.cpp --run --port 8080Forgetting to enter the project directory
Wrong:
vix new api
vix run2
Correct:
vix new api
cd api
vix run2
3
Using VIX_LOG_LEVEL=release
Wrong:
VIX_LOG_LEVEL=release vix runCorrect for release builds:
vix run --preset releaseVIX_LOG_LEVEL controls logging, not the build profile.
Expecting vix run to behave exactly like vix dev
vix run runs manually.
For continuous reload during development, use:
vix devOr:
vix run --watchPassing script compiler flags as runtime args
Wrong:
vix run main.cpp --args -O2Correct:
vix run main.cpp -- -O2Passing script runtime args as compiler flags
Wrong:
vix run main.cpp -- --name GaspardCorrect:
vix run main.cpp --run --name GaspardTroubleshooting
The program does not receive arguments
For script mode:
vix run main.cpp --run arg1 arg2Or:
vix run main.cpp --args arg1 --args arg2For project mode:
vix run api --args arg1 --args arg2A compiler flag is treated as an app argument
Use -- in script mode:
vix run main.cpp -- -O2A runtime argument is treated as a compiler flag
Use --run in script mode:
vix run main.cpp --run --port 8080The app cannot find files
Set the runtime working directory:
vix run api --cwd ./runtimeNeed environment variables
vix run api --env APP_ENV=dev --env PORT=8080Need hot reload
vix run api --watchOr:
vix devNeed more details
vix run api --verboseOr:
VIX_LOG_LEVEL=debug vix run apiNeed less output
vix run api --quiet.env is missing
If .env.example exists and you want Vix to show a hint when .env is missing, enable:
VIX_SHOW_ENV_HINT=1 vix runThen create your local environment file:
cp .env.example .envBest practices
Use vix run when you want to build and run something manually.
Use vix dev when you are actively editing code and want automatic reload.
Use vix build when you only want to compile.
Use vix check when you want validation.
Use vix tests when you want to run tests.
Use vix replay when you want to inspect or reproduce recorded runs.
Use --run for script runtime arguments.
Use -- for script compiler and linker flags.
Use --env for run-specific environment variables.
Use --cwd when your program depends on runtime files.
Use --replay when the run may need to be reproduced later.
Difference between vix run, vix dev, and vix build
| Command | Purpose | Builds | Runs | Watches | Restarts |
|---|---|---|---|---|---|
vix build | Compile only | yes | no | no | no |
vix run | Build and run manually | yes | yes | no by default | no by default |
vix run --watch | Build, run, watch | yes | yes | yes | yes |
vix dev | Development loop | yes | yes | yes | yes |
Related commands
| Command | Purpose |
|---|---|
vix dev | Run with development reload. |
vix build | Configure and compile. |
vix check | Validate build, tests, runtime, and sanitizers. |
vix tests | Run tests. |
vix replay | Inspect and replay previous Vix executions. |
vix task | Run reusable project tasks. |
Next step
Continue with development mode.