The mvx bootstrap provides a way to use mvx in any project without requiring users to install mvx separately. This is similar to how Maven Wrapper (mvnw) works for Maven projects.
The bootstrap consists of lightweight shell/batch scripts that automatically download and execute the appropriate mvx Go binary for your platform.
Once you have the bootstrap files in your project, users can simply run:
# Unix/Linux/macOS
./mvx setup
./mvx build
./mvx test
# Windows
mvx.cmd setup
mvx.cmd build
mvx.cmd testThe bootstrap will automatically:
- Check for local development binaries in the project directory
- Check for a cached version in
~/.mvx/versions/ - Download the appropriate binary from GitHub releases if needed
- Execute the binary with all provided arguments
The bootstrap is designed to work seamlessly with locally compiled binaries for development:
# Build a development binary
./mvx build # Creates ./mvx-binary
# Use the wrapper - it automatically finds your development binary
./mvx version
./mvx setup
./mvx buildThe bootstrap automatically detects and uses ./mvx-dev for development.
# 1. Build your changes
./mvx build
# 2. Test with wrapper immediately
./mvx version # Uses your development binary
./mvx setup # Tests your changes
./mvx build # Runs your development version
# 3. Make changes and rebuild
# Edit code...
./mvx build # Rebuild
./mvx test # Test again
# 4. No need to install or update anything!The bootstrap consists of these files:
mvx- Unix/Linux/macOS shell script (bootstrap, not a binary)mvx.cmd- Windows batch script (bootstrap, not a binary).mvx/mvx.properties- Configuration filemvx-dev- Local development binary (optional, for development)
You can specify which version of mvx to use in several ways (in order of precedence):
- Environment variable:
MVX_VERSION=1.0.0 - Properties file: Set
mvxVersion=1.0.0in.mvx/mvx.properties - Version file: Put the version in
.mvx/version - Default: Uses
latestif nothing is specified
The .mvx/mvx.properties file supports:
# The version of mvx to download and use
mvxVersion=latest
# Alternative download URL (optional)
# mvxDownloadUrl=https://github.com/gnodet/mvx/releasesFor simplicity, you can just put the version in .mvx/version:
1.0.0
or
latest
The bootstrap automatically detects your platform and downloads the appropriate binary:
- Linux x64:
mvx-linux-amd64 - macOS x64:
mvx-darwin-amd64 - macOS ARM64:
mvx-darwin-arm64 - Windows x64:
mvx-windows-amd64.exe
Downloaded binaries are cached in ~/.mvx/versions/{version}/ to avoid re-downloading:
~/.mvx/
├── versions/
│ ├── 1.0.0/
│ │ └── mvx
│ └── 1.1.0/
│ └── mvx
└── tools/
└── (tool caches)
By default, binaries are downloaded from GitHub releases:
https://github.com/gnodet/mvx/releases/download/v{version}/mvx-{platform}
You can override this with the MVX_DOWNLOAD_URL environment variable or mvxDownloadUrl property.
To add the mvx bootstrap to your project:
-
Copy the bootstrap files to your project root:
mvx(Unix script)mvx.cmd(Windows script).mvx/mvx.properties.mvx/version(optional)
-
Make the Unix script executable:
chmod +x mvx
-
Configure the version in
.mvx/mvx.properties -
Commit the files to your repository
-
Update your documentation to use
./mvxinstead ofmvx
# Setup project (downloads tools, sets up environment)
./mvx setup
# Build the project
./mvx build
# Run tests
./mvx test
# Run custom commands defined in .mvx/config
./mvx run demo
# Show version information
./mvx version
# Get help
./mvx --helpIf downloads fail:
- Check your internet connection
- Verify the version exists in GitHub releases
- Check if you're behind a corporate firewall
- Try setting a custom download URL
On Unix systems, make sure the script is executable:
chmod +x mvxTo see what version is being resolved:
# The bootstrap will show version information before executing
./mvx version- Zero Installation: No need to install mvx globally
- Version Consistency: Everyone on the team uses the same mvx version
- Offline Support: Cached binaries work offline
- Cross-Platform: Works on Linux, macOS, and Windows
- Simple: Just run
./mvxinstead ofmvx
If you're migrating from a globally installed mvx:
- Add the bootstrap files to your project
- Update build scripts and documentation to use
./mvx - Team members can uninstall global mvx if desired
- CI/CD systems no longer need to install mvx
The bootstrap provides the same functionality as a global installation but with better version control and consistency.