.gitignore Generator

Gitignore for macOS

Generate a .gitignore file for macOS projects. Includes .DS_Store, Thumbs.db, and other OS-specific files.

100% client-side. Your data never leaves your browser.

Related Tools

Gitignore for macOS

This example generates a comprehensive .gitignore file for macOS development. It includes patterns for .DS_Store files, macOS system files, Xcode artifacts, and other Apple-specific files that shouldn’t be committed to version control.

What’s Included

macOS System Files

Xcode (if applicable)

Time Machine

How to Use

  1. Click “Generate” to create the .gitignore file
  2. Copy the generated content
  3. Create a .gitignore file in your project root
  4. Paste the content and save
  5. If you have existing .DS_Store files, remove them from git tracking

Removing Existing .DS_Store Files

If .DS_Store files are already tracked in your repository:

# Find and delete all .DS_Store files
find . -name .DS_Store -delete

# Untrack them from git
git rm --cached .DS_Store

# Add to .gitignore (if not already there)
echo ".DS_Store" >> .gitignore

# Commit the changes
git add .gitignore
git commit -m "Remove .DS_Store files from tracking"

Set up a global gitignore to ignore macOS files in all your projects:

# Create global gitignore
echo -e ".DS_Store\n._*\n.AppleDouble\n.LSOverride\n.Spotlight-V100\n.Trashes\nIcon?" > ~/.gitignore_global

# Configure git to use it
git config --global core.excludesfile ~/.gitignore_global

This way, you never have to add macOS-specific patterns to each project’s .gitignore.