Fix "errors in crontab file, can't install"
This error means crontab rejected your file during save. Almost always it's a malformed schedule line, a missing final newline, or a comment/variable written incorrectly.
What the error means
When you save from crontab -e, crontab validates the file. If any line is malformed it prints errors in crontab file, can't install and keeps the old crontab.
Common causes
- Wrong number of fields — a schedule needs exactly 5 time fields then the command. A missing field or an extra space in the wrong place breaks it.
- Bad value — e.g. minute 60 or month 13. Ranges are minute 0-59, hour 0-23, day 1-31, month 1-12, weekday 0-7.
- No trailing newline — the last line must end with a newline. Add a blank line at the end.
- Unescaped percent — a literal % in the command must be written as \%.
How to find it
Crontab reports the line number. Re-run crontab -e, go to that line, and fix the field count or value. When it saves cleanly the error is gone.
FAQ
What causes 'errors in crontab file, can't install'?
A malformed line: wrong number of fields, an out-of-range value like minute 60, a missing final newline, or an unescaped % in the command.
How do I find which line is wrong?
Crontab prints the offending line number. Open crontab -e, jump to that line, and correct the field count or value; it installs once every line is valid.
Does the crontab file need a trailing newline?
Yes. The last line must end with a newline. Add a blank line at the end if saving fails.