vix dev
vix dev starts a Vix target in development mode.
It builds, runs, watches, rebuilds, and restarts automatically while you edit code.
Use it during active development.
vix devOverview
vix dev is the development entrypoint for Vix.
It is designed for a fast feedback loop:
edit
save
detect change
rebuild
restart
continue2
3
4
5
6
It works with:
- the current project
- a project directory or target name
- a
vix.appproject - a CMake project
- a single C++ file
- a
.vixmanifest - Vue fullstack projects
- long-running servers
- short-lived scripts
- apps that need runtime arguments
- apps that need environment variables
- apps that need SQLite, MySQL, or sanitizer modes
Internally, vix dev is development mode on top of vix run.
It automatically enables watch mode and dev mode.
Conceptually:
vix dev
-> vix run --watch --dev-mode2
Usage
vix dev [target] [options] [-- compiler/linker flags] [--run <args...>]Basic examples
# Start the current project in dev mode
vix dev
# Start a named project or target
vix dev api
# Start a project from another directory
vix dev --dir ./examples/blog
# Start a single C++ file in dev mode
vix dev server.cpp
# Start a .vix manifest in dev mode
vix dev app.vix
# Pass runtime arguments to a script
vix dev server.cpp --run --port 8080
# Pass runtime arguments with repeatable args
vix dev api --args --port --args 8080
# Pass compiler flags to a script
vix dev server.cpp -- -O2 -DNDEBUG2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
What vix dev does
When you run:
vix devVix performs these steps:
- Resolves the target.
- Configures the project when needed.
- Builds the target.
- Finds the executable when possible.
- Starts the app.
- Watches relevant files.
- Classifies file changes.
- Rebuilds or reconfigures when needed.
- Restarts the app automatically.
- Stops cleanly on
Ctrl+C.
The goal is simple:
keep the app running while you edit
rebuild only when relevant files change
restart safely when the app needs to restart2
3
Difference between vix dev and vix run --watch
vix dev is close to:
vix run --watchBut vix dev is the dedicated development command.
It automatically adds:
--watch
--dev-mode2
Use vix dev when you are editing.
Use vix run --watch when you want manual control from the run command.
Supported targets
| Target | Mode | Example |
|---|---|---|
| No target | Current project | vix dev |
| Project directory or target name | Project mode | vix dev api |
| Single C++ file | Script mode | vix dev server.cpp |
.vix manifest | Manifest mode | vix dev app.vix |
vix dev is focused on development sessions.
For runtime targets such as Docker, SSH, HTTP, or direct binary execution, prefer vix 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 devRun a named project or target:
vix dev apiRun from another directory:
vix dev --dir ./apps/apiProject mode can:
- resolve the project root
- configure when needed
- build the target
- run the app
- watch source and config files
- rebuild on source changes
- reconfigure on project config changes
- restart the app
CMake and vix.app project resolution
Vix respects this project resolution order:
1. CMakeLists.txt
2. vix.app2
If CMakeLists.txt exists, Vix uses the CMake project.
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 run the development session.
Script mode
Script mode is used when the target is a single C++ file.
vix dev server.cppThis is useful for:
- prototypes
- demos
- quick servers
- small tools
- learning
- experiments
- testing Vix APIs without creating a full project
Force server behavior:
vix dev server.cpp --force-serverForce short-lived script behavior:
vix dev tool.cpp --force-scriptManifest mode
Manifest mode is used when the target is a .vix file.
vix dev app.vixThe manifest is loaded first.
Then CLI options are applied on top.
Examples:
vix dev app.vix
vix dev app.vix --env APP_ENV=dev
vix dev app.vix --args --port --args 80802
3
Watch mode
Watch mode is enabled by default in vix dev.
These are equivalent:
vix dev
vix dev --watch
vix dev --reload2
3
When a relevant file changes, Vix:
- waits for a small debounce delay
- classifies the change
- stops the running app
- rebuilds or reconfigures
- restarts the app
File change classification
vix dev classifies changes into three kinds:
ignore
rebuild-only
reconfigure-and-rebuild2
3
Ignored changes
Some files and directories are ignored because they should not trigger a rebuild.
Ignored directories include:
.git
.vix
build
build-dev
build-ninja
build-release
node_modules
.cache
.idea
.vscode
docs
doc
dist
out
coverage2
3
4
5
6
7
8
9
10
11
12
13
14
15
Ignored files include common non-build files such as:
README.md
CHANGELOG.md
LICENSE
.gitignore2
3
4
Editing these files does not reload the app.
Rebuild-only changes
Source and header changes trigger a rebuild and restart.
Source extensions:
.cpp
.cc
.cxx
.c2
3
4
Header extensions:
.hpp
.hh
.hxx
.h
.ipp
.inl2
3
4
5
6
Example:
changed: /home/user/api/src/main.cppVix rebuilds and restarts the app.
Reconfigure and rebuild changes
Project configuration changes trigger reconfigure and rebuild.
Config files include:
CMakeLists.txt
CMakePresets.json
vix.json
vix.toml
vix.lock
*.cmake2
3
4
5
6
When one of these changes, Vix treats it as a configuration change.
This matters because targets, dependencies, build options, presets, or project layout may have changed.
File index
vix dev uses a file index to detect changes.
The index tracks:
path
mtime
file size
change kind2
3
4
This avoids unnecessary rebuilds and keeps watch mode fast.
Debounce behavior
When a file changes, Vix waits briefly before rebuilding.
This avoids rebuilding multiple times while an editor is still writing files.
After the debounce delay, Vix selects the most relevant change.
If one change requires reconfigure and rebuild, that change wins over normal rebuild-only changes.
Build behavior
vix dev uses the normal Vix build pipeline.
During dev rebuilds, Vix runs a fast build command internally.
The development rebuild command is based on:
vix build --build-target all --fastwith options such as:
-j
-v
--with-sqlite
--with-mysql2
3
4
when they are provided.
This means dev mode can benefit from Vix build improvements such as fast no-op checks, cache behavior, and build diagnostics.
Configure behavior
If the build directory has no CMake cache, Vix configures the project.
The configure step uses:
CMake
Ninja
Debug build type
compile_commands.json2
3
4
When SQLite, MySQL, or sanitizers are enabled, Vix adds the relevant configuration flags.
If configure fails, Vix prints the error and waits for the next file change.
Build directory
Project dev mode uses the development build directory.
Common build directory:
build-ninjaExample:
/home/user/api/build-ninjaTarget behavior
vix dev runs the resolved project target.
For a project named:
apiVix expects a runnable target named:
apiWhen the executable exists, Vix starts it.
When no executable is found, Vix treats the project like a library project.
Library projects
Some projects are libraries and do not produce a runnable executable.
If Vix builds successfully but cannot find a runnable executable, it prints a library-oriented message and keeps watching.
Example behavior:
Library built.
No runnable executable found. Watching for changes.
Use `vix tests` to run the test suite.2
3
Use vix tests to run tests for library projects.
Executable detection
After building, Vix looks for the executable in common locations:
build-ninja/<target>
build-ninja/bin/<target>
build-ninja/src/<target>2
3
It can also scan the build directory recursively.
Test binaries are ignored when resolving the main app executable.
Runtime process
When the executable is found, Vix starts it as a child process.
The child process receives:
VIX_MODE=dev
VIX_STDOUT_MODE=line2
If SQLite mode is enabled, Vix sets:
VIX_DB_ENGINE=sqlite
VIX_ENABLE_DB=1
VIX_DB_USE_SQLITE=12
3
If MySQL mode is enabled, Vix sets:
VIX_DB_ENGINE=mysql
VIX_ENABLE_DB=1
VIX_DB_USE_MYSQL=12
3
Sanitizer environment is also applied when sanitizer options are enabled.
Restart behavior
When a relevant file changes, Vix restarts the app.
The restart flow is:
detect change
debounce
print changed file
send SIGINT
wait briefly
send SIGTERM if needed
send SIGKILL if needed
rebuild
start new process2
3
4
5
6
7
8
9
This makes restarts safer than killing immediately.
Stopping dev mode
Press:
Ctrl+CVix handles SIGINT and SIGTERM.
It stops the dev session and terminates the child process.
Example output:
Stopping dev session...Vue fullstack projects
vix dev can detect Vue fullstack projects.
A Vue frontend is detected when:
vix.json contains "template"
vix.json contains "vue"
vix.json contains "frontend"
frontend/package.json exists2
3
4
When detected, Vix starts the Vue dev server with:
npm run devfrom:
frontend/It also sets:
VIX_FRONTEND=vueWhen the dev session stops, Vix stops the Vue frontend process too.
This lets one vix dev session run both:
Vix C++ backend
Vue frontend2
Runtime arguments
Use --run for script runtime arguments:
vix dev server.cpp --run --port 8080Use repeatable --args for runtime arguments:
vix dev api --args --port --args 8080
vix dev server.cpp --args --port --args 80802
Important argument rule
In script mode, -- is for compiler or linker flags.
Do not use it for runtime arguments.
Wrong:
vix dev server.cpp -- --port 8080Correct:
vix dev server.cpp --run --port 8080Or:
vix dev server.cpp --args --port --args 8080Compiler and linker flags
In script mode, everything after -- is treated as compiler or linker flags.
vix dev server.cpp -- -O2 -DNDEBUGAdd include paths:
vix dev server.cpp -- -I./includeLink libraries:
vix dev server.cpp -- -lssl -lcryptoWorking directory
Use --cwd to run the application from a specific working directory.
vix dev api --cwd ./runtime
vix dev server.cpp --cwd ./data2
If no --cwd is provided, the child process runs from the project directory.
Environment variables
Use --env to add or override environment variables for the running app.
vix dev api --env APP_ENV=dev
vix dev api --env APP_ENV=dev --env PORT=8080
vix dev server.cpp --env PORT=80802
3
Each --env accepts one KEY=value pair.
Force server mode
Use --force-server when the target is a long-running app such as an HTTP server or WebSocket server.
vix dev server.cpp --force-serverThis is useful for single-file servers.
Force script mode
Use --force-script when the target is a short-lived CLI tool.
vix dev tool.cpp --force-scriptThis avoids treating a short-lived tool like a long-running server.
Auto dependencies
Use --auto-deps to add include paths from installed local Vix dependencies.
vix dev main.cpp --auto-depsEquivalent local form:
vix dev main.cpp --auto-deps=localSearch dependencies in parent folders too:
vix dev main.cpp --auto-deps=upLocal script cache
Use --local-cache when you want the script cache to be local to the current working directory.
vix dev main.cpp --local-cacheSQLite support
Enable SQLite support:
vix dev --with-sqlite
vix dev server.cpp --with-sqlite2
When enabled, Vix can configure the build with SQLite-related options and set runtime environment variables for SQLite mode.
MySQL support
Enable MySQL support:
vix dev --with-mysql
vix dev server.cpp --with-mysql2
When enabled, Vix can configure the build with MySQL-related options and set runtime environment variables for MySQL mode.
Sanitizers
Enable AddressSanitizer and UBSan:
vix dev server.cpp --sanEnable UBSan only:
vix dev server.cpp --ubsanEnable ThreadSanitizer:
vix dev server.cpp --tsanUse sanitizers when debugging:
- memory errors
- undefined behavior
- thread issues
OpenAPI docs mode
vix dev supports the same docs mode flags as vix run.
Enable docs:
vix dev api --docsDisable docs:
vix dev api --no-docsExplicit values:
vix dev api --docs=true
vix dev api --docs=false
vix dev api --docs=1
vix dev api --docs=02
3
4
When enabled, Vix sets:
VIX_DOCS=1When disabled, Vix sets:
VIX_DOCS=0Replay recording
Use --replay to record dev runs under .vix/runs/.
vix dev api --replay
vix dev server.cpp --replay2
Recorded runs can later be inspected with:
vix replay list
vix replay last
vix replay failed2
3
Terminal clearing
Control terminal clearing:
vix dev api --clear=auto
vix dev api --clear=always
vix dev api --clear=never2
3
Disable clearing:
vix dev api --no-clear--no-clear is equivalent to:
--clear=neverLogging
Set log level:
vix dev --log-level debugSupported levels:
trace
debug
info
warn
error
critical
off2
3
4
5
6
7
Use verbose mode:
vix dev --verbose
vix dev -v2
Use quiet mode:
vix dev --quiet
vix dev -q2
Log format
Set log format:
vix dev --log-format kv
vix dev --log-format json
vix dev --log-format json-pretty2
3
Log color
Control colored output:
vix dev --log-color auto
vix dev --log-color always
vix dev --log-color never2
3
Disable colors:
vix dev --no-colorDev output
Normal output is compact:
Dev api (dev)
✔ Configured
✔ Started pid=123452
3
Verbose output shows more detail:
vix dev -vExample:
Dev api (dev)
watching: /home/user/api
target : api
build : /home/user/api/build-ninja
press Ctrl+C to stop2
3
4
5
When a file changes:
Dev api (dev)
changed: /home/user/api/src/main.cpp2
When the app starts:
✔ Started pid=12389When the app exits cleanly:
Dev app exited cleanly. Session stopped.Build failures in dev mode
If the build fails, Vix prints the build error and keeps the dev session alive.
It then waits for another relevant file change.
Example behavior:
Build failed in dev mode.
Fix the errors, save your files, and Vix will rebuild automatically.2
This is important because a failed save should not force you to restart the whole dev session.
Runtime exits in dev mode
If the child app exits with code 0, Vix treats it as a clean exit and stops the session.
If it exits with a non-zero code, Vix reports the exit code.
For long-running servers, use:
vix dev server.cpp --force-serverPlatform support
The full DevSession implementation is Unix-oriented.
On Windows, the dev session can fall back or report that the current dev session implementation is not available yet.
For normal one-shot execution on Windows, use:
vix runOptions
| Option | Description |
|---|---|
[target] | Project, target, .cpp file, or .vix manifest. |
-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 starting dev mode. |
--replay | Record runs 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 | Watch files and restart. Enabled by default in vix dev. |
--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. |
--with-mysql | Enable MySQL support. |
--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, -v | Alias for debug-style output. |
--quiet, -q | 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. |
Environment variables
| Variable | Description |
|---|---|
VIX_MODE=dev | Set automatically for the running app when not already set. |
VIX_STDOUT_MODE=line | Set automatically to make runtime output easier to stream. |
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_CLI_CLEAR | Terminal clear behavior. |
VIX_DB_ENGINE | Set to sqlite or mysql when database mode is enabled. |
VIX_ENABLE_DB | Set when database mode is enabled. |
VIX_DB_USE_SQLITE | Set when SQLite mode is enabled. |
VIX_DB_USE_MYSQL | Set when MySQL mode is enabled. |
VIX_FRONTEND=vue | Set for the Vue frontend process. |
VIX_SHOW_ENV_HINT=1 | Shows a hint when .env.example exists but .env is missing. |
Common workflows
Start a new app
vix new api
cd api
vix install
vix dev2
3
4
Run an existing app
cd api
vix install
vix dev2
3
Run from another directory
vix dev --dir ./apps/apiRun a server file directly
vix dev server.cpp --force-serverRun a CLI tool file directly
vix dev tool.cpp --force-scriptPass runtime arguments
Project:
vix dev api --args --port --args 8080Script:
vix dev server.cpp --run --port 8080Pass compiler flags to a script
vix dev server.cpp -- -O2 -DNDEBUGUse more build jobs
vix dev -j 8Enable SQLite
vix dev server.cpp --with-sqliteEnable MySQL
vix dev server.cpp --with-mysqlEnable sanitizers
vix dev server.cpp --sanEnable docs
vix dev api --docsEnable verbose dev output
vix dev -vEnable debug logs
VIX_LOG_LEVEL=debug vix devRecord a dev run
vix dev api --replayCommon mistakes
Running outside the project directory
Wrong:
vix new api
vix dev2
Correct:
vix new api
cd api
vix dev2
3
Passing runtime args after -- in script mode
In script mode, -- is for compiler and linker flags.
Wrong:
vix dev server.cpp -- --port 8080Correct:
vix dev server.cpp --run --port 8080Or:
vix dev server.cpp --args --port --args 8080Expecting vix dev to build every target manually
vix dev is for development sessions.
For full repository validation or install preparation, use:
vix build --build-target allUsing VIX_LOG_LEVEL=release
Wrong:
VIX_LOG_LEVEL=release vix devCorrect for release builds:
vix build --preset releaseVIX_LOG_LEVEL controls logging, not the build profile.
Editing ignored files and expecting reload
Files such as README.md, docs, .git, .vix, build output, and node_modules are ignored by dev mode.
Editing them does not trigger reload.
Expecting Windows dev sessions to behave like Unix dev sessions
The current full dev session orchestration is Unix-oriented.
On Windows, use one-shot commands such as:
vix run
vix build2
when full dev session support is not available.
Troubleshooting
Nothing happens after saving
Make sure the file is watched.
Watched files include:
.cpp
.cc
.cxx
.c
.hpp
.hh
.hxx
.h
.ipp
.inl
.cmake
CMakeLists.txt
CMakePresets.json
vix.json
vix.toml
vix.lock2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Ignored files and directories do not trigger reload.
The app does not restart
Make sure the rebuild succeeds.
If the build fails, Vix waits for the next file change.
Fix the error, save again, and Vix will rebuild automatically.
The executable cannot be found
Vix expects the resolved target executable to exist in the build directory.
Common locations:
build-ninja/<target>
build-ninja/bin/<target>
build-ninja/src/<target>2
3
Make sure the project defines a runnable executable target.
For library projects, use:
vix testsThe Vue frontend does not start
Make sure the project has:
frontend/package.jsonand that the frontend can run:
cd frontend
npm run dev2
The app cannot find files
Set the runtime working directory:
vix dev api --cwd ./runtimeNeed environment variables
vix dev api --env APP_ENV=dev --env PORT=8080Need more details
vix dev -vor:
VIX_LOG_LEVEL=debug vix devNeed less output
vix dev --quietNeed to restart after a failed build
Just fix the file and save again.
Vix keeps the dev session alive and rebuilds on the next relevant change.
Best practices
Use vix dev while coding.
Use vix build before committing or packaging.
Use vix build --build-target all before install or full repository validation.
Use vix check when you want deeper validation.
Use vix tests for test suites.
Use vix run when you want a manual one-shot run.
Use vix replay when you need to inspect recorded runs.
Use --run for script runtime arguments.
Use -- only for script compiler or linker flags.
Use --force-server for single-file servers.
Use --force-script for short-lived tools.
Difference between vix dev, vix run, 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 session | yes | yes | yes | yes |
Related commands
| Command | Purpose |
|---|---|
vix run | Build and run manually. |
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
Build the project without running it.