This post was originally published on go2linux.org on February 7, 2008. The domain is no longer mine, but I am the original author. I am republishing it here on garron.me with corrections and improvements.

Introduction

When you compile software from source and run make install, the files get scattered across your filesystem with no record of where they went. Removing the software later means hunting down every file manually.

checkinstall solves this: it intercepts make install, watches which files get written, and wraps them into a proper .deb or .rpm package. You install that package normally, so your package manager knows about it and can remove it cleanly.

Installation

On Debian and Ubuntu:

sudo apt install checkinstall

On Fedora:

sudo dnf install checkinstall

On CentOS/RHEL:

sudo yum install checkinstall

How it works

The standard workflow for compiling from source is:

./configure
make
make install     # ← checkinstall replaces this step

Instead of make install, you run:

sudo checkinstall

checkinstall runs make install internally while tracking every file it writes, then builds a package from those files and installs it via dpkg (on Debian/Ubuntu) or rpm (on Fedora/CentOS).

Walkthrough example

As an example, compiling htop from source on Debian/Ubuntu:

# Install build dependencies
sudo apt install build-essential libncursesw5-dev autotools-dev autoconf automake

# Download and extract source
wget https://github.com/htop-dev/htop/releases/download/3.3.0/htop-3.3.0.tar.xz
tar xf htop-3.3.0.tar.xz
cd htop-3.3.0

# Configure and compile
./autogen.sh && ./configure
make

# Install as a .deb package
sudo checkinstall --pkgname=htop --pkgversion=3.3.0 --default

The --default flag accepts all defaults without interactive prompts.

Interactive prompts

Without --default, checkinstall asks you to fill in package metadata:

Please write a description for the package.
>> htop 3.3.0 compiled from source

*****************************************
**** Debian package creation selected ***
*****************************************
0 - Maintainer: [ root@hostname ]
1 - Summary:    [ htop 3.3.0 compiled from source ]
2 - Name:       [ htop ]
3 - Version:    [ 3.3.0 ]
4 - Release:    [ 1 ]
5 - License:    [ GPL ]
6 - Group:      [ checkinstall ]
7 - Architecture: [ amd64 ]

Press the number of any field to edit it, then Enter to confirm.

Useful flags

| Flag | Effect | |---|---| | --pkgname=name | Set the package name | | --pkgversion=ver | Set the version string | | --default | Accept all defaults, no prompts | | --install=no | Build the package but do not install it | | -D | Force Debian (.deb) package format | | -R | Force RPM package format | | -S | Force Slackware (.tgz) package format |

Removing the package later

Since the package is registered with your package manager, removal is clean:

sudo dpkg -r htop          # Debian/Ubuntu
sudo rpm -e htop           # Fedora/CentOS

Notes

  • checkinstall works with any build system that has an install target, not just make. Pass the install command as an argument: sudo checkinstall ninja install.
  • It does not resolve dependencies — you are responsible for ensuring build and runtime dependencies are installed.
  • For production systems, building proper packages with debuild or rpmbuild is more robust. checkinstall is best suited for quick personal installations.