fsck - macOS


fsck (File System Consistency Check) is a command-line utility in macOS used to check and optionally repair file system issues. It’s primarily used to diagnose and fix errors that may occur due to improper shutdowns, system crashes, or hardware failures. It is essential for maintaining the integrity of the file system, especially in UNIX-based systems like macOS.


The general syntax for fsck is as follows:

fsck [options] [filesystem]
  • [options]: These are the flags or arguments you can provide to modify the behavior of fsck.
  • [filesystem]: Specifies which filesystem to check; it can be a device name (like /dev/disk0s2), UUID, or label.


Here are some of the most commonly used options in fsck:

  • -p: Automatically repair (“preen”) the file system without any user intervention.
  • -n: Assume a “no” response to all questions asked by fsck (does not make any changes to the file system).
  • -y: Assume a “yes” response to all questions asked by fsck (makes repairs as needed).
  • -q: Quick check; it exits after checking the clean flag (useful for scripts).
  • -f: Force checking even if the system believes the filesystem is clean.

Typical use cases:

  • Use -p for regular maintenance scripts where no user intervention is expected.
  • Use -y when booting into single user mode and needing to repair a disk.
  • Use -n for safely checking the status of a filesystem without altering it.


  1. Check and repair the file system on disk0s2:
    sudo fsck -fy /dev/disk0s2
  2. Run a quick check:
    fsck -q /dev/disk1s1

Common Issues

  • Filesystem is busy: This error occurs when trying to run fsck on a mounted volume. To avoid this, ensure the volume is unmounted or use the utility in single-user mode.
  • Permission Denied: Running fsck requires administrative privileges; use sudo to run the command.


fsck can be integrated with other commands for scripting and automation. For instance, you can combine it with cron to schedule regular filesystem checks.

Example script

This script checks the filesystem on boot and logs the output:

echo "Starting fsck check: $(date)" >> "$LOGFILE"
sudo fsck -p /dev/disk2s1 >> "$LOGFILE"
echo "Completed fsck check: $(date)" >> "$LOGFILE"
  • mount: Useful for mounting file systems.
  • umount: Essential for unmounting file systems before using fsck.
  • diskutil: A versatile tool for managing disks and file systems in macOS.

For more detailed information on fsck and its usage, refer to the official man page by typing man fsck in your terminal or visiting the official Apple support page.

This manual provides a broad overview of fsck, aiming to inform and guide users in maintaining the health and integrity of their file systems effectively.