Skip to main content

Installation

Haft can be installed on Linux, macOS, and Windows.

Requirements​

  • Go 1.21+ (for building from source)
  • Java 17+ (for generated projects)
  • Maven 3.6+ or Gradle 7+ (for generated projects)

The easiest way to install Haft:

curl -fsSL https://raw.githubusercontent.com/KashifKhn/haft/main/install.sh | bash

This automatically:

  • Detects your OS and architecture
  • Downloads the latest release
  • Installs to /usr/local/bin or ~/.local/bin

Using Go​

If you have Go installed:

go install github.com/KashifKhn/haft/cmd/haft@latest

This installs the haft binary to your $GOPATH/bin directory.

From Source​

Clone and build from source:

git clone https://github.com/KashifKhn/haft.git
cd haft
make build

The binary will be at ./bin/haft. Move it to your PATH:

sudo mv ./bin/haft /usr/local/bin/

Binary Releases​

Download pre-built binaries from GitHub Releases.

Linux​

# AMD64
curl -L https://github.com/KashifKhn/haft/releases/latest/download/haft-linux-amd64.tar.gz | tar xz
sudo mv haft-linux-amd64 /usr/local/bin/haft

# ARM64
curl -L https://github.com/KashifKhn/haft/releases/latest/download/haft-linux-arm64.tar.gz | tar xz
sudo mv haft-linux-arm64 /usr/local/bin/haft

macOS​

# Intel Mac
curl -L https://github.com/KashifKhn/haft/releases/latest/download/haft-darwin-amd64.tar.gz | tar xz
sudo mv haft-darwin-amd64 /usr/local/bin/haft

# Apple Silicon
curl -L https://github.com/KashifKhn/haft/releases/latest/download/haft-darwin-arm64.tar.gz | tar xz
sudo mv haft-darwin-arm64 /usr/local/bin/haft

Windows​

  1. Download haft-windows-amd64.zip from the releases page
  2. Extract the ZIP file
  3. Add the extracted folder to your system PATH

Or using PowerShell:

# Download and extract
Invoke-WebRequest -Uri "https://github.com/KashifKhn/haft/releases/latest/download/haft-windows-amd64.zip" -OutFile "haft.zip"
Expand-Archive -Path "haft.zip" -DestinationPath "."
Move-Item "haft-windows-amd64.exe" "$env:LOCALAPPDATA\Microsoft\WindowsApps\haft.exe"

Verify Installation​

haft version

You should see output like:

haft version vX.Y.Z

Shell Completions​

Haft supports shell completions for bash, zsh, fish, and PowerShell. Tab completions help you discover commands and flags without memorizing them.

Bash​

Load for current session:

source <(haft completion bash)

Load permanently (Linux):

# System-wide
haft completion bash > /etc/bash_completion.d/haft

# User-only
haft completion bash > ~/.local/share/bash-completion/completions/haft

Load permanently (macOS with Homebrew):

haft completion bash > $(brew --prefix)/etc/bash_completion.d/haft

Zsh​

Load for current session:

source <(haft completion zsh)

Load permanently (Linux):

# Ensure completion is enabled in ~/.zshrc:
# autoload -U compinit; compinit

haft completion zsh > "${fpath[1]}/_haft"

Load permanently (macOS with Homebrew):

haft completion zsh > $(brew --prefix)/share/zsh/site-functions/_haft

Start a new shell session for changes to take effect.

Fish​

Load for current session:

haft completion fish | source

Load permanently:

haft completion fish > ~/.config/fish/completions/haft.fish

PowerShell​

Load for current session:

haft completion powershell | Out-String | Invoke-Expression

Load permanently:

Add to your PowerShell profile ($PROFILE):

haft completion powershell | Out-String | Invoke-Expression

Or save to a file and source it:

haft completion powershell > haft.ps1
# Add `. /path/to/haft.ps1` to your profile

Updating​

To update to the latest version:

# Using the install script (recommended)
curl -fsSL https://raw.githubusercontent.com/KashifKhn/haft/main/install.sh | bash

# If installed via Go
go install github.com/KashifKhn/haft/cmd/haft@latest

# If installed from source
cd haft
git pull
make build

Uninstalling​

# Remove the binary
sudo rm /usr/local/bin/haft

# Or from ~/.local/bin
rm ~/.local/bin/haft

# Or if installed via Go
rm $(which haft)