Skip to content

Quick Start

Here we take Nodejs as an example to introduce how to use vfox.

1. Installation

Windows

shell
scoop install vfox

Unix-like

shell
brew install vfox

2. Hook vfox to your Shell

⚠️ Warning

Please select a command suitable for your Shell from below to execute!

shell
echo 'eval "$(vfox activate bash)"' >> ~/.bashrc
source ~/.bashrc

3. Add a Plugin

Command: vfox add <plugin-name>

After installing vfox, you also need to install the corresponding plugin to manage SDK.

💡 Tip

You can use the vfox available command to see all available plugins.

bash
vfox add nodejs

4. Install a Runtime

After the plugin is successfully installed, you can install the corresponding version of Node.js.

Command: vfox install nodejs@<version>

bash
vfox install nodejs@21.5.0

⚠️ About the Latest Version

latest is a special marker that takes the first version (usually the latest) from the list of available versions returned by the plugin. Both install and use commands support this marker, but it is not recommended for production use.

bash
vfox install nodejs@latest
vfox use -g nodejs@latest

Why not recommended? latest always points to the current latest version, but new versions may introduce breaking changes or unstable features, which can easily cause compatibility issues in your project.

💡 Recommended Approach

Always use exact version numbers to ensure project stability and reproducibility. You can use vfox search nodejs to query all available versions.

💡 Auto-install Plugin

install and search commands will automatically detect and install missing plugins.

5. Switch Runtime

Command: vfox use [-p -g -s] [--unlink] nodejs[@<version>]

vfox supports three scopes, with version priority from high to low:

Project > Session > Global > System

📌 Default Behavior

vfox defaults to Session level, if you don't specify -p (project level) or -g (global) flags, using vfox use command is equivalent to vfox use -s. When you close the shell session, the Session level configuration is automatically cleaned up and destroyed.

Scope Overview

ScopeCommandSDK PathEffective Range
Projectvfox use -p$PWD/.vfox/sdksCurrent project directory
Sessionvfox use -s~/.vfox/tmp/<pid>/sdksCurrent Shell session
Globalvfox use -g~/.vfox/sdksGlobal

📖 How It Works

vfox creates directory symlinks in different scopes pointing to actual SDK installation directories, and adds these paths to the PATH environment variable in priority order, enabling version switching.

PATH Priority Example:

bash
# Project > Session > Global > System
$PWD/.vfox/sdks/nodejs/bin:~/.vfox/tmp/<pid>/nodejs/bin:~/.vfox/sdks/nodejs/bin:/usr/bin:...

Project (Project Scope)

💡 Recommended

For project development, each project can have independent tool versions.

Usage:

bash
# Use nodejs in current project directory
vfox use -p nodejs@20.9.0

After execution, vfox will:

  1. Create directory symlinks: Create a symlink in $PWD/.vfox/sdks/nodejs pointing to the actual installation directory
  2. Auto-add to .gitignore: If a .gitignore file exists, vfox will automatically add the .vfox/ directory to the ignore list to prevent committing to the repository
  3. Update PATH: Insert $PWD/.vfox/sdks/nodejs/bin at the front of PATH
  4. Save configuration: Write version information to .vfox.toml file

This way, when you execute node command in the project directory, Shell will find your project-level nodejs at the front of PATH, ensuring the version matches project requirements.

Visual Example:

bash
# 1. Execute command
$ vfox use -p nodejs@20.9.0

# 2. View created symlink
$ ls -la .vfox/sdks/nodejs
lrwxr-xr-x  1 user  staff  nodejs -> /Users/user/.vfox/cache/nodejs/v-20.9.0/nodejs-20.9.0

# 3. View updated PATH
$ echo $PATH
/project/path/.vfox/sdks/nodejs/bin:/previous/paths:...
#                  ↑ Project-level nodejs at the front

# 4. View configuration file
$ cat .vfox.toml
[tools]
nodejs = "20.9.0"

# 5. Verify version (using project-level version)
$ node -v
v20.9.0

💡 Highly Recommended

Commit .vfox.toml to your repository and add .vfox directory to .gitignore. This way team members can share version configuration.

⚠️ About the --unlink Parameter

If you don't want to create symlinks in the project directory, you can use the --unlink parameter:

bash
vfox use -p --unlink nodejs@20.9.0

Note: After using --unlink, the Project scope downgrades to Session scope (configuration recorded in .vfox.toml but without creating symlinks). We strongly recommend keeping the default behavior (creating symlinks).


Session (Session Scope)

💡 Temporary Testing

For temporarily testing a specific version, automatically expires when you close the current Shell window.

Usage:

bash
vfox use -s nodejs@18.0.0

📝 Important Reminder

  • Session-level scoping: vfox use -s only takes effect within the current shell session
  • Automatic cleanup: When you close the shell window/session, the temporary directory and configuration are automatically cleaned up
  • Not affecting other sessions: Changes only apply to the current session and do not affect other shell sessions or global settings

When you close the Shell window, the temporary directory and configuration are cleaned up automatically, not affecting other Shell sessions.

Global (Global Scope)

💡 User-Level Default Version

For setting user-level default versions, available for all projects (unless overridden by Project or Session).

Usage:

bash
vfox use -g nodejs@21.5.0

Demo

Text descriptions are not as intuitive as pictures. Let's see the demo directly!

nodejs

Quick Start Complete! 🎉

Congratulations on completing the vfox quick start! Now you can:

  • ✅ Quickly install and switch between different versions of development tools
  • ✅ Configure independent tool versions for your projects
  • ✅ Temporarily test specific tool versions
  • ✅ Share consistent development environment configuration with your team

Next Steps:

Use vfox --help to see more commands and options, or visit All Commands to learn more features.

Released under the Apache 2.0 License.