Skip to content

Installation

mocks can be installed in several ways. Choose the method that best fits your environment.

If you’re using Homebrew on macOS, you can install from the dedicated tap:

Terminal window
brew install mocks-rs/tap/mocks

If you’re using Node.js, you can install mocks globally via npm:

Terminal window
npm install -g @mocks-rs/mocks

Or use it without installing:

Terminal window
npx @mocks-rs/mocks --help

Example usage with npx:

Terminal window
# Initialize a storage file
npx @mocks-rs/mocks init storage.json
# Run the mock server
npx @mocks-rs/mocks run storage.json

System Requirements: Node.js 18.0.0 or higher

If you have a Rust development environment, you can install directly from cargo:

Terminal window
cargo install mocks

You can download pre-built binaries for your platform from the GitHub Releases page:

  1. Visit GitHub Releases
  2. Select the binary for your platform from the latest version assets
  3. Extract the downloaded file and place it in an executable location

After installation, you can verify the installation with the following commands:

Terminal window
mocks --version
Terminal window
mocks --help
  • Supported OS: Linux, macOS, Windows
  • Minimum Rust Version: 1.78.0+ (when installing via Cargo)

Once installation is complete, try creating your first mock API with the Quick Start guide.