Crontab Won't Install: errors in crontab file
When crontab -e says 'errors in crontab file, can't install. Do you want to retain the old version?', cron found a syntax problem — most often a missing newline at the end of the file or a schedule line with the wrong number of fields. Fix the flagged line and save again.
Most common causes
1. Missing final newline — the last line must end with a line break. 2. Wrong field count — a schedule needs exactly five time fields then the command. 3. Bad variable line — set variables as NAME=value with no export keyword.
Find the bad line
Every real job line looks like 0 3 * * * /path/to/job.sh — five fields then a command. Comments start with #. Count the fields on each non-comment, non-blank line.
Reinstall cleanly
Answer y to keep editing, fix the line, and save. Or write a known-good file and load it: crontab mycron.txt, then confirm with crontab -l.
Watch for editor issues
Ensure the file ends with a newline and uses Unix (LF) line endings, not Windows (CRLF), which can also trigger the error.
FAQ
What causes 'errors in crontab file, can't install'?
A syntax problem cron rejected — usually a missing final newline, a schedule line with the wrong number of fields, or CRLF line endings.
How do I fix a crontab that won't install?
Reopen with crontab -e, ensure each job has five time fields then a command, add a trailing newline, save. Or load a known-good file with crontab mycron.txt.
Does crontab need a newline at the end?
Yes. The file must end with a line break or cron may refuse to install it.