dot_clean - macOS


The dot_clean command on macOS merges ._* files (AppleDouble format used on macOS to store additional metadata about a file) with their corresponding native files. This operation is useful for cleaning up file systems that do not support macOS extended attributes, such as non-HFS volumes, thereby reducing clutter and potential compatibility issues when files are accessed on other platforms or via network shares.


dot_clean [options] <directory>
  • <directory>: Specifies the path where you want dot_clean to operate. This command will recursively merge all ._* files with their corresponding native files in the specified directory.


  • -h: Help message. Displays usage information and exits.
  • -m: Always delete dot-underbar files from network-mounted volumes.
  • -n: Never delete dot-underbar files when merging.
  • -f: Force dot-underbar file to delete even if the native file is read-only.
  • -s: Follow symbolic links. Operate on the target of links; otherwise, dot_clean will operate on the link itself.
  • -v: Verbose mode. Outputs detailed information about what dot_clean is doing.
  • -c: Check if dot-underbar files can be removed. Displays information about what would be merged and deleted but does not perform the operations.
  • -x: Exclude network volumes. Skips the cleaning operation on network file systems.


  1. Basic Usage:
    Clean up metadata in the Documents directory:

    dot_clean ~/Documents
  2. Verbose Output:
    Merge files in Downloads with verbose output:

    dot_clean -v ~/Downloads
  3. Excluding Network Volumes:
    Clean up without affecting network-mounted volumes:

    dot_clean -x /Volumes/ExternalDrive
  4. Checking Operation Without Execution:
    See what would be cleaned in the Music folder without making changes:

    dot_clean -c ~/Music

Common Issues

  • Permission Denied: If you encounter permission errors, make sure you have the necessary permissions to modify the files. Using sudo might solve this issue.
  • Ignoring Network Volumes: Issues might arise if .DS_Store or other dot-underbar files are not managed on network volumes. Use the -x flag to exclude these volumes.


Merge with find to selectively clean directories:

find /path/to/clean -name "*.ext" -exec dot_clean {} \;

This finds specific file types and runs dot_clean on those directories, helping with targeted cleaning.

  • xattr: Manipulate extended attributes of files.
  • rm: Remove files or directories.
  • find: Search for files in a directory hierarchy.

For more extensive documentation, visit the Apple Developer Documentation.