Skip to content

Instantly share code, notes, and snippets.

@pixeljammed
Created June 14, 2025 01:04
Show Gist options
  • Select an option

  • Save pixeljammed/cf01f8a2eebe5780db61358198417e4f to your computer and use it in GitHub Desktop.

Select an option

Save pixeljammed/cf01f8a2eebe5780db61358198417e4f to your computer and use it in GitHub Desktop.
GOODBYE, .DS_STORE, FOREVER!

Tutorial

  1. CD to your GitHub folder

cd (drag & drop your folder into terminal after typing cd)

  1. Run this

find . -name ".DS_Store" -type f -delete

  1. Quickly commit your repos*

  2. Run this:

git config --global core.excludesfile "~/.gitignore" && echo .DS_Store >> ~/.gitignore




*Explanation

  1. moves to the folder in terminal where you're going to purge .DS_Store's
  2. recursively deletes all .DS_Stores inside that folder & subfolders
  3. .DS_Stores are automatically recreated, so we have to commit fast before they are recreated by Finder
  4. adds .DS_store to your global git config, will create one if you don't have one already

Footnotes

  • If you can't commit in time, try this for a true PERMA f--k off experience: sudo find / -name “.DS_Store” -depth -exec rm {} \;

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment