Skip to main content
DevOps Insightsguides & answers

Make · troubleshooting

Makefile: *** missing separator

make found a line in your Makefile that it cannot read as a rule, a variable or a recipe. Almost always a recipe line indented with spaces instead of a tab; sometimes a merge-conflict marker or shell code left outside a recipe.

Reproduced on GNU Make 4.3, . Where the text says “reproduced”, the behaviour was run on that version, not taken from documentation.

First published

New to this? Read what is actually happening first, then come back to the steps.

On this page · 8 sections

Before you start

  • The file name and line number from the message; that is the line to look at.

Run this first

step 1 of 1
cat -et Makefile | sed -n 'LINEp'

Look for Leading spaces, or a line that is not a rule, variable or recipe

Shows the reported line with tabs as ^I, so spaces and tabs stop looking identical.

Work out which cause you have

A few questions to narrow the list. Every answer ends in a command that confirms or rules the cause out — this cannot see your cluster, so nothing here is a certainty until you have checked.

Narrow it down

0 answered · nothing is sent anywhere

What is on the reported line (cat -et Makefile shows tabs as ^I)?

Cause space

4 of 4 still possible

  • A recipe line is indented with spaces, not a tabCommon
  • A merge-conflict marker was left in the fileOccasional
  • Shell code is written outside a recipeOccasional
  • .RECIPEPREFIX is not supported by the make that runs itRare

Nothing ruled out yet. Answer the question above and the branches your answer eliminates will strike through here.

Or diagnose it manually

In this order. The first command usually contains the whole answer.

  1. Step 1

    cat -et Makefile | sed -n 'LINEp'

    Shows the reported line with tabs as ^I, so spaces and tabs stop looking identical.

    Look for Leading spaces, or a line that is not a rule, variable or recipe

Every cause, and how to fix it

Ordered by how often each one turns out to be the answer.

A recipe line is indented with spaces, not a tab

Common

An editor, a paste from a web page or a formatter replaced the tab with spaces.

Confirm

cat -et Makefile | sed -n 'LINEp'

The reported line starting with spaces instead of ^I

Fix

  • Replace the leading spaces with one tab, in an editor that shows whitespace.
  • Stop it recurring: in .editorconfig, add a [Makefile] section with indent_style = tab.

A merge-conflict marker was left in the file

Occasional

A line such as <<<<<<< HEAD, ======= or >>>>>>> branch is not valid Makefile syntax.

Confirm

grep -nE '^(<<<<<<<|=======|>>>>>>>)' Makefile

Any line printed: an unresolved conflict

Fix

  • Resolve the conflict properly, keep the lines you meant, and delete the markers.

Shell code is written outside a recipe

Occasional

A shell if, for loop or command at the top level of the Makefile is read as Makefile syntax, which it is not.

Confirm

sed -n 'LINEp' Makefile

A shell command at the reported line that is not under a target

Fix

  • Move it into a recipe under a target, indented with a tab, or use make's own syntax (ifeq, $(shell …)) for decisions at the top level.

.RECIPEPREFIX is not supported by the make that runs it

Rare

GNU Make 3.82 and later let you choose another recipe prefix with .RECIPEPREFIX. macOS ships GNU Make 3.81, which ignores it, so every recipe line then fails.

Confirm

make --version | head -1

GNU Make 3.81 with a Makefile that sets .RECIPEPREFIX

Fix

  • Use tabs, which every make understands, or install a newer GNU make and call it explicitly (on macOS with Homebrew it is gmake).

Understanding it properly

Skip this if you are mid-incident — the working part of the page is above. Worth reading afterwards, because understanding the mechanism is what stops the next one.

In plain terms

In a Makefile, the commands under a target must start with a tab character, not spaces. Many editors quietly turn tabs into spaces, and the two look identical on screen. make reads a space-indented command as a broken line and stops at it, naming the file and line number.

Words used on this page

Recipe
The commands under a target, which make runs to build it. Each recipe line starts with a tab.
cat -et
Prints a file showing invisible characters: a tab appears as ^I and each line end as $.
What is actually happening

Reproduced with GNU Make 4.3 on Ubuntu 24.04 and GNU Make 3.81 on macOS. A recipe indented with four spaces stopped with "Makefile:2: *** missing separator. Stop." and exit code 2. With eight spaces, both versions add a hint: "(did you mean TAB instead of 8 spaces?)". The same line indented with a tab ran.

Two other things gave the same message at their own line number: a leftover merge-conflict marker (<<<<<<< HEAD), and a shell if statement written outside any recipe. Windows line endings (CRLF) did not cause it in either version.

How to tell this is your problem
WhereWhat you see
makeMakefile:LINE: *** missing separator. Stop.
make*** missing separator (did you mean TAB instead of 8 spaces?). Stop.

How to know it is actually fixed

  • make runs the target without the error.

Stopping it happening again

  • Set indent_style = tab for Makefiles in .editorconfig, so editors and formatters keep the tabs.
  • Run make -n (print commands without running them) in CI to catch a broken Makefile early.

Sources

Behaviour described here is drawn from official documentation. Where a figure could not be confirmed on an official page it is attributed in the text rather than stated as canonical.

Did this get you to an answer?

No text box on purpose — please do not paste production logs anywhere

Something wrong or out of date? Report it