Skip to content
Latchkey

make Exit Code 2 in CI: Build Recipe Failures Explained

make exits 2 when a build recipe fails or it encounters a usage/rule error - the canonical "the build broke" code from make.

A step exiting 2 from make means make itself reported a failure. The real cause is the command inside the failing recipe, printed just above.

What it means

make uses exit 2 for errors: a recipe command exited non-zero, or there was a problem with the Makefile (missing target, syntax). Exit 1 only appears with -q (query mode). Exit 0 means success.

Common causes

  • A compiler or shell command in a recipe failed.
  • A missing target or prerequisite.
  • A tab/whitespace or syntax error in the Makefile.

How to fix it

Find the make: *** [target] Error N line and read the command output above it - that failing command is the real cause. Re-run with make -d for rule-level detail if needed.

Related guides

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