macOS .gitignore Template

The full, current macOS .gitignore template — copy it as-is, or head to the .gitignore Generator to merge it with other stacks into one file.

Template

# General
.DS_Store
.localized
__MACOSX/
.AppleDouble
.LSOverride
Icon[
]

# Resource forks
._*

# Files and directories that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.com.apple.timemachine.supported
.PKInstallSandboxManager
.PKInstallSandboxManager-SystemSoftware
.hotfiles.btree
.vol
.file
.disk_label*
lost+found
.HFS+ Private Directory Data[
]

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Mac OS 6 to 9
Desktop DB
Desktop DF
TheFindByContentFolder
TheVolumeSettingsFolder
.FBCIndex
.FBCSemaphoreFile
.FBCLockFolder

# Quota system
.quota.group
.quota.user
.quota.ops.group
.quota.ops.user

# TimeMachine
Backups.backupdb
.MobileBackups
.MobileBackups.trash
MobileBackups.trash
tmbootpicker.efi

What each entry does

Why every line in this template is excluded, not just what it matches.

Entry Why it's excluded
.DS_Store macOS Finder's per-folder metadata file (icon positions, view settings) — pure OS clutter with no project value.
.localized Files matching .localized — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
__MACOSX/ A generated/local directory (__MACOSX) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
.AppleDouble Files matching .AppleDouble — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.LSOverride Files matching .LSOverride — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
Icon[ A generated/local directory (Icon[) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
] A generated/local directory (]) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
._* Files matching ._* — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.DocumentRevisions-V100 Files matching .DocumentRevisions-V100 — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.fseventsd Files matching .fseventsd — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.Spotlight-V100 Files matching .Spotlight-V100 — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.TemporaryItems Files matching .TemporaryItems — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.Trashes Files matching .Trashes — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.VolumeIcon.icns Files matching .VolumeIcon.icns — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.com.apple.timemachine.donotpresent Files matching .com.apple.timemachine.donotpresent — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.com.apple.timemachine.supported Files matching .com.apple.timemachine.supported — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.PKInstallSandboxManager Files matching .PKInstallSandboxManager — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.PKInstallSandboxManager-SystemSoftware Files matching .PKInstallSandboxManager-SystemSoftware — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.hotfiles.btree Files matching .hotfiles.btree — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.vol Files matching .vol — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.file Files matching .file — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.disk_label* Files matching .disk_label* — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
lost+found A generated/local directory (lost+found) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
.HFS+ Private Directory Data[ Files matching .HFS+ Private Directory Data[ — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.AppleDB Files matching .AppleDB — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.AppleDesktop Files matching .AppleDesktop — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
Network Trash Folder A generated/local directory (Network Trash Folder) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
Temporary Items A generated/local directory (Temporary Items) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
.apdisk Files matching .apdisk — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
Desktop DB A generated/local directory (Desktop DB) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
Desktop DF A generated/local directory (Desktop DF) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
TheFindByContentFolder A generated/local directory (TheFindByContentFolder) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
TheVolumeSettingsFolder A generated/local directory (TheVolumeSettingsFolder) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff.
.FBCIndex Files matching .FBCIndex — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.FBCSemaphoreFile Files matching .FBCSemaphoreFile — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.FBCLockFolder Files matching .FBCLockFolder — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.quota.group Files matching .quota.group — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.quota.user Files matching .quota.user — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.quota.ops.group Files matching .quota.ops.group — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.quota.ops.user Files matching .quota.ops.user — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
Backups.backupdb Files matching Backups.backupdb — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.MobileBackups Files matching .MobileBackups — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
.MobileBackups.trash Files matching .MobileBackups.trash — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
MobileBackups.trash Files matching MobileBackups.trash — a generated or machine-specific file type for this stack, safe to regenerate rather than track.
tmbootpicker.efi Files matching tmbootpicker.efi — a generated or machine-specific file type for this stack, safe to regenerate rather than track.