The /cores folder can hold gigabytes of crash dumps nobody asked for
Core dumps are full memory snapshots written when a program crashes, and each can be gigabytes. Where they live, why they appear, and how to remove them.
At the top of your disk there is a folder called /cores. On most Macs it is empty. On some, particularly developer machines, it holds files named core.1234 that are each several GB, and together they can be tens of GB.
ls -lh /cores
du -sh /coresWhat a core file is
When a program crashes, the system can write a complete copy of its memory to disk, a core dump, so a developer can later see exactly what went wrong. A program using 4 GB of memory produces a 4 GB file. macOS does not write them by default. They appear when something has turned them on.
Why you might have them
- A developer tool or script ran
ulimit -c unlimited, which lets crashing programs write cores. - A shell profile, such as
~/.zshrc, sets core dumps on for every Terminal session. - A test or crash reporter was configured to collect them.
# Is it on in your shell right now? 0 means off
ulimit -c
# Is it set in your profile?
grep -n "ulimit -c" ~/.zshrc ~/.bash_profile ~/.zprofile 2>/dev/nullRemoving them
Core files are only useful to whoever is debugging that crash. If that is not you, or you have finished, delete them:
sudo rm /cores/core.*This one is removed directly rather than via the Trash, because /cores is a system folder. Then remove any ulimit -c unlimited line from your profile so they do not return.
For other hidden system folders that grow, see private var folders.
Common questions
What is the /cores folder on a Mac?
It holds core dumps, full memory snapshots of programs that crashed. macOS does not create them by default, so they appear only when something has enabled them.
Is it safe to delete files in /cores?
Yes, unless you are debugging the crash that made them. They are copies of memory from programs that already crashed.
How do I stop core dumps on my Mac?
Remove any ulimit -c unlimited line from your shell profile, such as ~/.zshrc, and open a new Terminal window.