.gitignore for macOS

44 ignore rules for macOS, ready to copy into your repository.

Apple's desktop operating system

The complete .gitignore for macOS

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 17:00:39 UTC
# Technologies: macOS

### macOS ###
# macOS folder settings (Desktop Services Store)
.DS_Store
# macOS resource fork files
.AppleDouble
.localized
# macOS custom folder icon
.LSOverride
__MACOSX/
# macOS custom icon file (Icon^M)
Icon[
]
# macOS resource fork files
._*
# macOS version history
.DocumentRevisions-V100
# macOS file system events daemon
.fseventsd
# macOS Spotlight index
.Spotlight-V100
# macOS temporary files
.TemporaryItems
# macOS trash folder
.Trashes
# macOS AppleDB cache
.AppleDB
# macOS volume icon
.VolumeIcon.icns
# macOS desktop settings
.AppleDesktop
# macOS Time Machine marker
.com.apple.timemachine.donotpresent
.com.apple.timemachine.supported
# macOS network trash
Network Trash Folder
.PKInstallSandboxManager
# macOS temporary items
Temporary Items
.PKInstallSandboxManager-SystemSoftware
# macOS AppleTalk disk info
.apdisk
.hotfiles.btree
.vol
.file
.disk_label*
lost+found
.HFS+ Private Directory Data[
]
Desktop DB
Desktop DF
TheFindByContentFolder
TheVolumeSettingsFolder
.FBCIndex
.FBCSemaphoreFile
.FBCLockFolder
.quota.group
.quota.user
.quota.ops.group
.quota.ops.user
Backups.backupdb
.MobileBackups
.MobileBackups.trash
MobileBackups.trash
tmbootpicker.efi

What these macOS rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

General

Pattern What it ignores
.DS_Store macOS folder settings (Desktop Services Store)
.AppleDouble macOS resource fork files
.localized General
__MACOSX/ General
.LSOverride macOS custom folder icon
Icon[ ] macOS custom icon file (Icon^M)

Resource forks

Pattern What it ignores
._* macOS resource fork files

Files and directories that might appear in the root of a volume

Pattern What it ignores
.DocumentRevisions-V100 macOS version history
.fseventsd macOS file system events daemon
.Spotlight-V100 macOS Spotlight index
.TemporaryItems macOS temporary files
.Trashes macOS trash folder
.VolumeIcon.icns macOS volume icon
.com.apple.timemachine.donotpresent macOS Time Machine marker
.com.apple.timemachine.supported Files and directories that might appear in the root of a volume
.PKInstallSandboxManager Files and directories that might appear in the root of a volume
.PKInstallSandboxManager-SystemSoftware Files and directories that might appear in the root of a volume
.hotfiles.btree Files and directories that might appear in the root of a volume
.vol Files and directories that might appear in the root of a volume
.file Files and directories that might appear in the root of a volume
.disk_label* Files and directories that might appear in the root of a volume
lost+found Files and directories that might appear in the root of a volume
.HFS+ Private Directory Data[ ] Files and directories that might appear in the root of a volume

Directories potentially created on remote AFP share

Pattern What it ignores
.AppleDB macOS AppleDB cache
.AppleDesktop macOS desktop settings
Network Trash Folder macOS network trash
Temporary Items macOS temporary items
.apdisk macOS AppleTalk disk info

Mac OS 6 to 9

Pattern What it ignores
Desktop DB Mac OS 6 to 9
Desktop DF Mac OS 6 to 9
TheFindByContentFolder Mac OS 6 to 9
TheVolumeSettingsFolder Mac OS 6 to 9
.FBCIndex Mac OS 6 to 9
.FBCSemaphoreFile Mac OS 6 to 9
.FBCLockFolder Mac OS 6 to 9

Quota system

Pattern What it ignores
.quota.group Quota system
.quota.user Quota system
.quota.ops.group Quota system
.quota.ops.user Quota system

TimeMachine

Pattern What it ignores
Backups.backupdb TimeMachine
.MobileBackups TimeMachine
.MobileBackups.trash TimeMachine
MobileBackups.trash TimeMachine
tmbootpicker.efi TimeMachine

How to use this .gitignore for macOS

  1. Copy the macOS rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.

Other Operating System .gitignore templates

See every Operating System template