| Crates.io | cargox-cli |
| lib.rs | cargox-cli |
| version | 0.1.0 |
| created_at | 2025-10-15 18:09:51.541292+00 |
| updated_at | 2025-10-15 18:09:51.541292+00 |
| description | Run Cargo binaries on demand, installing them via cargo-binstall when missing. |
| homepage | |
| repository | https://github.com/pkgxdev/cargox |
| max_upload_size | |
| id | 1884762 |
| size | 131,391 |
cargoxcargox runs Rust binaries on demand, installing them automatically if necessary.
It mirrors the convenience of npx for the Cargo ecosystem while prioritising
cargo-binstall to download prebuilt executables whenever possible.
crate[@version] binaries, installing them on demand.cargo-binstall for fast installs falling back to cargo install.--.cargox <crate[@version]> [--] [binary-args...]
Examples:
# Run the latest wasm-pack, installing it if necessary
cargox bat ./README.md
# Install and run a pinned version
cargox cargo-deny@0.16.3 check
# Force a reinstall, building from source instead of using cargo-binstall
cargox --force --build-from-source cargo-nextest
[!TIP]
- Arguments before the first positional are passed to
cargox.- Arguments after
--are passed to the invoked binary.- Use
--if necessary to define the separation point.
--bin <name>: choose a specific binary when a crate exposes several.-f, --force: reinstall even if the binary already exists on PATH.-q, --quiet: suppress installer output (still prints a short status line).-s, --build-from-source: build from source using cargo install instead of cargo-binstall.Every binary installed by cargox is stored with an explicit version suffix. For example, running cargox bat@0.24.0 produces bin/bat-0.24.0 under the install root. When you invoke cargox bat without a version, the newest installed version is selected automatically. The special specifier @latest triggers a crates.io lookup to install and run the newest published release if a newer one exists.
cargox operates in a completely sandboxed environment, isolated from your
system's Cargo installation. This ensures that binaries installed by cargox are
separate and don't interfere with your regular cargo install workflow.
Default install locations:
~/.local/share/cargox/bin (XDG Data Directory)~/Library/Application Support/cargox/bin%APPDATA%\cargox\binCustomizing the install directory:
You can override the default by setting:
CARGOX_INSTALL_DIR: Custom location for cargox installationsComplete sandboxing:
cargox ensures complete isolation by:
Not checking standard Cargo directories: Binaries in ~/.cargo/bin,
~/.local/bin, /usr/local/bin, or CARGO_HOME/bin are ignored when looking
for already-installed binaries.
Binary lookup is restricted to:
PATH (via which)cargox install directory onlyEnvironment isolation: When installing packages, cargox removes all
Cargo-related environment variables (like CARGO_INSTALL_ROOT, CARGO_HOME,
BINSTALL_INSTALL_PATH, etc.) to prevent any leakage into the installation
process. Only the controlled cargox install directory is set.
This sandboxing guarantees that:
cargox binaries won't accidentally shadow your regular Cargo binariesBuild artifact cleanup:
cargox automatically cleans up build artifacts after installation:
cargo-binstall, binaries are downloaded pre-built (no artifacts to clean)cargo install, build artifacts are placed in a temporary directory
that is automatically cleaned up after installation completesThis keeps your system clean and prevents build cache bloat.