Skip to content

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:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.3.4/prek-installer.sh | 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)

brew install prek

mise

To use prek with mise (v2025.8.11 or later):

mise use prek

npm

prek is published as a Node.js package and can be installed with any npm-compatible package manager:

# npm
npm install -g @j178/prek

# pnpm
pnpm add -g @j178/prek

# bun
bun install -g @j178/prek

Or as a project dependency:

npm add -D @j178/prek

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.

conda install conda-forge::prek

Scoop (Windows)

prek is available via Scoop.

scoop install main/prek

Winget (Windows)

prek is available via winget.

winget install --id j178.Prek

MacPorts

prek is available via MacPorts.

sudo port install prek

cargo-binstall

Install pre-compiled binaries from GitHub using cargo-binstall:

cargo binstall prek

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):

cargo install --locked prek

Updating

If installed via the standalone installer, prek can update itself to the latest version:

prek self update

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:

echo 'eval "$(COMPLETE=bash prek)"' >> ~/.bashrc
echo 'eval "$(COMPLETE=zsh prek)"' >> ~/.zshrc
echo 'COMPLETE=fish prek | source' >> ~/.config/fish/config.fish
Add-Content -Path $PROFILE -Value '$env:COMPLETE = "powershell"; prek | Out-String | Invoke-Expression; Remove-Item Env:\COMPLETE'

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.