Makefile Missing Separator Error — Tab vs Spaces Indentation Issue
About Makefile Missing Separator Error
Fix the 'missing separator' error in Makefiles caused by using spaces instead of tabs for recipe indentation, which is required by make syntax. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Make requires recipe lines (commands under targets) to be indented with a tab character, not spaces. The 'missing separator' error on a specific line means that line uses spaces instead of a tab. This is one of the most common Makefile errors for developers new to make. Modern editors may be configured to insert spaces when Tab is pressed, causing this error. The tab requirement is a historical artifact from make's creation in 1976. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Editor configured to insert spaces instead of tabs (expandtab in vim, insertSpaces in VS Code). Copied Makefile content from a website that converted tabs to spaces. Git or diff tool replaced tabs with spaces during merge or patch application. IDE reformatter applied space-based indentation to the Makefile. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Identify the error line from the error message: 'Makefile:LINE: *** missing separator. Stop.'. Replace spaces with a tab on that line — use the literal Tab key or your editor's tab character. Configure your editor for Makefiles: VS Code: add 'makefile' to insertSpaces: false in settings. Show whitespace in your editor to visually distinguish tabs from spaces. Use 'cat -A Makefile' to see tabs (shown as ^I) vs spaces in the file. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
Why does make require tabs?
It is a historical design decision from 1976 when make was created. The author, Stuart Feldman, chose tabs to distinguish recipe lines from other content. He later admitted it was a mistake but changing it would break compatibility.
Overview
Fix the 'missing separator' error in Makefiles caused by using spaces instead of tabs for recipe indentation, which is required by make syntax.
Key Details
- Make requires recipe lines (commands under targets) to be indented with a tab character, not spaces
- The 'missing separator' error on a specific line means that line uses spaces instead of a tab
- This is one of the most common Makefile errors for developers new to make
- Modern editors may be configured to insert spaces when Tab is pressed, causing this error
- The tab requirement is a historical artifact from make's creation in 1976
Common Causes
- Editor configured to insert spaces instead of tabs (expandtab in vim, insertSpaces in VS Code)
- Copied Makefile content from a website that converted tabs to spaces
- Git or diff tool replaced tabs with spaces during merge or patch application
- IDE reformatter applied space-based indentation to the Makefile
Steps
- 1Identify the error line from the error message: 'Makefile:LINE: *** missing separator. Stop.'
- 2Replace spaces with a tab on that line — use the literal Tab key or your editor's tab character
- 3Configure your editor for Makefiles: VS Code: add 'makefile' to insertSpaces: false in settings
- 4Show whitespace in your editor to visually distinguish tabs from spaces
- 5Use 'cat -A Makefile' to see tabs (shown as ^I) vs spaces in the file