.gitignore for macOS

macOS system files including .DS_Store, Spotlight, and Finder metadata.

Quick presets

Selected (1)
macOS
Your selections never leave your browser. Generation happens entirely client-side.
Raw

17 patterns · 381 B

# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator
# Templates: macOS
# 2026-04-20

# ---- macOS ----
# macOS
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

What this template ignores

Ignores macOS-specific metadata files like .DS_Store (Finder folder settings), .Spotlight-V100 (search index), and AppleDouble resource forks that macOS creates automatically.

Common additions

  • +*.dmg — disk image files you build locally
  • +.env — local environment variable files
  • +Thumbs.db — if sharing repo with Windows users

Commonly paired with

Frequently asked questions

Do I need to commit .gitignore?
Yes — .gitignore should be committed to the repository so all collaborators benefit from the same ignore rules.
How do I add custom patterns?
Open your .gitignore file and add the pattern on a new line. Use # for comments, * for wildcards, / to match directories, and ! to un-ignore a previously ignored path.
How do I ignore a file that is already tracked?
Adding a file to .gitignore does not remove it from tracking if it was previously committed. Run: git rm --cached <file> to stop tracking it without deleting the file locally.
Why is .DS_Store in almost every .gitignore?
.DS_Store stores Finder window settings (icon positions, view preferences). It is machine-specific and clutters diffs for every team member on macOS. It should never be committed.
Should I add macOS patterns to every project?
Yes if any contributor uses macOS. A global ~/.gitignore_global is an alternative that keeps it out of individual repos, but adding it per-repo is safer for teams.

Looking for something else? Browse all templates →