Skip to content
Latchkey

make install: Install and DESTDIR Staging

make install runs the install target, and DESTDIR=<path> stages files under a scratch root so CI never needs root.

Most autotools and hand-written Makefiles provide an install target. In CI you stage into a temporary DESTDIR so you can package or upload without writing to system directories.

What it does

make install executes the install target, copying binaries, libraries, and headers under the configured prefix. DESTDIR, honored by convention, prepends a staging directory to every install path, which is how distributions build packages.

Common usage

Terminal
make install
make DESTDIR=/tmp/stage install
make PREFIX=/opt/app install
make -C build install

Options

Variable / targetWhat it does
installThe conventional target that copies artifacts
DESTDIR=<path>Staging root prepended to every install path
PREFIX / prefixBase install location (set at configure or make time)
install-stripInstall with symbols stripped (autotools projects)
-C <dir>Run the install target from another directory

In CI

Prefer make DESTDIR=$PWD/stage install so the runner user can write without sudo, then tar or upload the staged tree. DESTDIR is applied at install time; PREFIX is usually baked in at ./configure time, so changing PREFIX at make install alone may not relocate everything.

Common errors in CI

"install: cannot create regular file '/usr/local/bin/app': Permission denied" means writing to a root-owned prefix without privileges; use DESTDIR staging instead. "make: *** No rule to make target 'install'" means the Makefile defines no install target. Files landing in the wrong place usually mean PREFIX was set at make time but the paths were fixed at configure time.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →