This guide helps developers install all necessary dependencies to run the pre-commit hooks on macOS and Windows.
# Run this script to install all dependencies on macOS
curl -fsSL https://raw.githubusercontent.com/TriaFed/pre-commit-library/main/install-macos.sh | bash# Run this script to install all dependencies on Windows
irm https://raw.githubusercontent.com/TriaFed/pre-commit-library/main/install-windows.ps1 | iexmacOS:
# Using Homebrew
brew install python3
# Using pyenv
brew install pyenv
pyenv install 3.11.0
pyenv global 3.11.0Windows:
# Using winget
winget install Python.Python.3.11
# Using Chocolatey
choco install python
# Or download from: https://python.org/downloads/macOS:
# Usually pre-installed, or:
brew install gitWindows:
# Using winget
winget install Git.Git
# Using Chocolatey
choco install gitBoth platforms:
pip install pre-commit
# or
pipx install pre-commitBoth platforms:
pip install black flake8 isort mypy bandit safety detect_secretsmacOS:
# Using Homebrew
brew install node
# Using nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install --ltsWindows:
# Using winget
winget install OpenJS.NodeJS
# Using Chocolatey
choco install nodejs
# Using nvs (Node Version Switcher)
winget install jasongin.nvsGlobal packages (both platforms):
npm install -g eslint prettier typescript @angular/climacOS:
# Using Homebrew
brew install --cask dotnet
# Or download from: https://dotnet.microsoft.com/downloadWindows:
# Using winget
winget install Microsoft.DotNet.SDK.8
# Using Chocolatey
choco install dotnet
# Or download from: https://dotnet.microsoft.com/downloadmacOS:
# Using Homebrew
brew install go
# Manual installation
curl -L https://go.dev/dl/go1.21.0.darwin-amd64.tar.gz | tar -C /usr/local -xz
export PATH=$PATH:/usr/local/go/binWindows:
# Using winget
winget install GoLang.Go
# Using Chocolatey
choco install golang
# Or download from: https://golang.org/dl/Go tools (both platforms):
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
go install honnef.co/go/tools/cmd/staticcheck@latestmacOS:
# Using Homebrew
brew install openjdk@17
# Using SDKMAN
curl -s "https://get.sdkman.io" | bash
sdk install java 17.0.2-openWindows:
# Using winget
winget install Microsoft.OpenJDK.17
# Using Chocolatey
choco install openjdk17Build tools:
# Maven
# macOS: brew install maven
# Windows: winget install Apache.Maven
# Gradle
# macOS: brew install gradle
# Windows: winget install Gradle.GradlemacOS:
# Using Homebrew
brew install terraform tflint
# Using tfenv for version management
brew install tfenv
tfenv install 1.5.0
tfenv use 1.5.0Windows:
# Using winget
winget install Hashicorp.Terraform
# Using Chocolatey
choco install terraform tflint
# Or download from: https://terraform.io/downloadsBoth platforms:
# Using pip
pip install ansible ansible_lint
# Using pipx (recommended)
pipx install ansible
pipx install ansible_lintBoth platforms:
# Semgrep
pip install semgrep
# TruffleHog
# macOS: brew install trufflehog
# Windows: winget install trufflesecurity.trufflehog
# Both: go install github.com/trufflesecurity/trufflehog/v3@latestmacOS:
# Using Homebrew
brew install hadolint
# Using Docker
docker pull hadolint/hadolintWindows:
# Using Chocolatey
choco install hadolint
# Using winget
winget install Hadolint.Hadolint
# Using Docker
docker pull hadolint/hadolintBoth platforms:
# AWS CLI
pip install awscli
# CloudFormation tools
pip install cfn-lintAfter installation, verify tools are working:
# Core tools
python3 --version
git --version
pre-commit --version
# Python tools
black --version
flake8 --version
bandit --version
# Node.js tools
node --version
npm --version
eslint --version
# .NET tools
dotnet --version
# Go tools
go version
golangci-lint --version
gosec --help
# Infrastructure tools
terraform --version
ansible --version
# Security tools
semgrep --version
trufflehog --versionIf you prefer not to install dependencies locally, most tools can run via Docker:
# Example: Run linting via Docker
docker run --rm -v $(pwd):/app -w /app node:18 npm install && npm run lint
# Example: Run Go checks via Docker
docker run --rm -v $(pwd):/app -w /app golang:1.21 go vet ./...
# Example: Run Python checks via Docker
docker run --rm -v $(pwd):/app -w /app python:3.11 pip install black && black --check .- Python 3.8+
- pip packages:
detect_secrets bandit safety semgrep
- All language runtimes (.NET, Go, Node.js, Python, Java)
- All linting tools
- Security scanning tools
- Docker + pre-commit Docker images
- Or language-specific CI images with tools pre-installed
Windows PATH Issues:
# Add to PATH manually or use:
$env:PATH += ";C:\Program Files\dotnet"
$env:PATH += ";C:\Program Files\Go\bin"macOS Permission Issues:
# Fix Python/pip permissions
sudo chown -R $(whoami) $(python3 -m site --user-base)
# Fix npm permissions
npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATHTool Not Found After Installation:
# Reload shell or source profile
source ~/.bashrc # or ~/.zshrc
# or restart terminalIf primary tools aren't available, hooks will suggest alternatives:
- golangci-lint β falls back to
go vet+staticcheck - ansible_lint β falls back to
ansible-playbook --syntax-check - hadolint β falls back to basic Dockerfile checks
Many tools integrate with popular IDEs for real-time feedback:
- VS Code: Extensions for ESLint, Prettier, Go, .NET, Python
- JetBrains: Built-in support for most linters
- Vim/Neovim: ALE, coc.nvim plugins
This ensures developers catch issues before pre-commit even runs!