Installing Kat
Kat is a CLI tool for performing PostgreSQL database migrations. This guide covers different methods to install Kat on your system.
Prerequisites
Before installing Kat, ensure your system meets the following requirements:
- PostgreSQL: Kat is designed to work with PostgreSQL databases
- Go: Version 1.20 or higher (only required for building from source)
Installation Methods
Using the Install Script (Recommended)
For macOS and Linux, the easiest way to install Kat is using the install script:
# Install latest version (automatically fetches the latest release)
curl -sSL https://kat.bolaji.de/install | bash
# Install specific version
curl -sSL https://kat.bolaji.de/install | VERSION=v1.0.0 bash
This will:
- Detect your operating system (macOS or Linux)
- Fetch the latest release version from GitHub if no version is specified
- Download the appropriate pre-compiled binary from GitHub Releases
- Install it to
/usr/local/bin
, making it available in your PATH
Manual Installation from Pre-compiled Binaries
You can also download and install the binary manually:
- Visit the GitHub Releases page
- Download the appropriate archive for your operating system (replace
[VERSION]
with the version you want, e.g.v1.0.0
):- macOS:
kat_[VERSION]_darwin_amd64.tar.gz
- Linux:
kat_[VERSION]_linux_amd64.tar.gz
- macOS:
- Extract the binary:
tar -xzf kat_[VERSION]_[os]_amd64.tar.gz
- Move the binary to a location in your PATH:
sudo mv kat /usr/local/bin/
- Make it executable:
sudo chmod +x /usr/local/bin/kat
Installing from Source
If you prefer to build from source or need to customize the installation:
- Clone the repository:
git clone https://github.com/BolajiOlajide/kat.git cd kat
- Install using make:
make install
This runs
go install ./...
, which compiles and installs the binary to your Go bin directory. - Alternatively, you can run:
go install github.com/BolajiOlajide/kat/cmd/kat@latest
This will download, compile, and install the latest version directly.
Verifying the Installation
To verify that Kat was installed correctly, run:
kat version
You should see output showing the version of Kat that you installed.
Troubleshooting
Common Issues
- Command not found
- Ensure the installation directory is in your PATH
- For Go installations, make sure
$GOPATH/bin
is in your PATH
- Permission denied
- Make sure the binary is executable:
chmod +x /path/to/kat
- You might need to use
sudo
for some installation steps
- Make sure the binary is executable:
- Installation fails
- Check your Go version:
go version
- Ensure you have internet access to download dependencies
- Check your Go version:
Getting Help
If you encounter any issues during installation:
- Check the GitHub Issues to see if others have faced similar problems
- Open a new issue with details about your environment and the error message
Next Steps
After successfully installing Kat, the next step is to initialize your project with Kat’s configuration and directory structure.