.gitignore for macOS
17 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: 2025-08-01 11:50:42 UTC
# Technologies: macOS
### macOS ###
# macOS folder settings (Desktop Services Store)
.DS_Store
# macOS resource fork files
.AppleDouble
# macOS custom folder icon
.LSOverride
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 volume icon
.VolumeIcon.icns
# macOS Time Machine marker
.com.apple.timemachine.donotpresent
# macOS AppleDB cache
.AppleDB
# macOS desktop settings
.AppleDesktop
# macOS network trash
Network Trash Folder
# macOS temporary items
Temporary Items
# macOS AppleTalk disk info
.apdisk
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 |
.LSOverride |
macOS custom folder icon |
Icon |
General |
Thumbnails
| Pattern | What it ignores |
|---|---|
._* |
macOS resource fork files |
Files 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 |
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 |
How to use this .gitignore for macOS
- Copy the macOS rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.