Installation¶
prek provides multiple installation methods to suit different needs and environments.
Standalone Installer¶
The standalone installer automatically downloads and installs the correct binary for your platform:
Use curl to download the script and execute it with sh:
Use irm to download the script and execute it with iex:
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.3.4/prek-installer.ps1 | iex"
Changing the execution policy allows running a script from the internet.
Tip
The installation script may be inspected before use. Alternatively, binaries can be downloaded directly from GitHub Releases.
Package Managers¶
PyPI¶
prek is published as Python binary wheel to PyPI, you can install it using pip, uv (recommended), or pipx:
# Using uv (recommended)
uv tool install prek
# Using uvx (install and run in one command)
uvx prek
# Adding prek to the project dev-dependencies
uv add --dev prek
# Using pip
pip install prek
# Using pipx
pipx install prek
Homebrew (macOS/Linux)¶
mise¶
To use prek with mise (v2025.8.11 or later):
npm¶
prek is published as a Node.js package and can be installed with any npm-compatible package manager:
Or as a project dependency:
Nix¶
prek is available via Nixpkgs.
# Choose what's appropriate for your use case.
# One-off in a shell:
nix-shell -p prek
# NixOS or non-NixOS without flakes:
nix-env -iA nixos.prek
# Non-NixOS with flakes:
nix profile install nixpkgs#prek
Conda¶
prek is available as prek via conda-forge.
Scoop (Windows)¶
prek is available via Scoop.
Winget (Windows)¶
prek is available via winget.
MacPorts¶
prek is available via MacPorts.
cargo-binstall¶
Install pre-compiled binaries from GitHub using cargo-binstall:
Docker¶
prek provides a Docker image at
ghcr.io/j178/prek.
See the guide on using prek in Docker for more details.
GitHub Releases¶
Pre-built binaries are available for download from the GitHub releases page.
Build from Source¶
Build from source using Cargo (Rust 1.89+ is required):
Updating¶
If installed via the standalone installer, prek can update itself to the latest version:
For other installation methods, follow the same installation steps again.
Shell Completion¶
Tip
Run echo $SHELL to determine your shell.
To enable shell autocompletion for prek commands, run one of the following:
Then restart your shell or source the config file.
Artifact Verification¶
Release artifacts are signed with GitHub Attestations to provide cryptographic proof of their origin. Verify downloads using the GitHub CLI:
$ gh attestation verify prek-x86_64-unknown-linux-gnu.tar.gz --repo j178/prek
Loaded digest sha256:xxxx... for file://prek-x86_64-unknown-linux-gnu.tar.gz
Loaded 1 attestation from GitHub API
✓ Verification succeeded!
- Attestation #1
- Build repo:..... j178/prek
- Build workflow:. .github/workflows/release.yml@refs/tags/vX.Y.Z
This confirms the artifact was built by the official release workflow.