1
0
mirror of https://github.com/j178/prek.git synced 2026-04-25 02:11:36 +02:00
Files
prek/docs/installation.md
T
Jo 84da002275 Mention j178/prek-action in docs (#753)
Huge thanks to @frostming for creating prek-action and for generously handing it over to me!
2025-09-16 15:47:35 +08:00

2.1 KiB

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:

Linux and macOS

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.2.1/prek-installer.sh | sh

Windows

powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.2.1/prek-installer.ps1 | iex"

Package Managers

PyPI

Install via pip, uv (recommended), or pipx:

# Using uv (recommended)
uv tool install prek

# Using pip
pip install prek

# Using pipx
pipx install prek

Homebrew (macOS/Linux)

brew install prek

mise

To use prek with mise:

mise use prek

Build from Source

cargo install --locked --git https://github.com/j178/prek

Download from GitHub Releases

Pre-built binaries are available for download from the GitHub releases page.

Updating

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

prek self update

For other installation methods, follow the same installation steps again.

Shell Completion

prek supports shell completion for Bash, Zsh, Fish, and PowerShell. To install completions:

Bash

COMPLETE=bash prek > /etc/bash_completion.d/prek

Zsh

COMPLETE=zsh prek completion > "${fpath[1]}/_prek"

Fish

COMPLETE=fish prek > ~/.config/fish/completions/prek.fish

PowerShell

COMPLETE=powershell prek >> $PROFILE

Use in GitHub Actions

prek can be used in GitHub Actions via the j178/prek-action repository.

Example workflow:

name: Prek checks
on: [push, pull_request]

jobs:
  prek:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: j178/prek-action@v1

This action installs prek and runs prek run --all-files on your repository.