• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

AppleToolBox

Tools and Fixes for Mac, iPad, iPhone & iWatch

Search posts

  • About
  • Contact

CONNECT WITH US

CATEGORIES

  • iPhone
  • iPad
  • iPod
  • Apple Watch
  • Mac/MacBook
  • AirPods
  • Apple TV
  • News
  • Apple Services
  • HomePod
  • Reviews

SITE

  • Home
  • About Us
  • Contact
  • Advertise

Search posts

You are here: Home / Mac / Mac OS X: How to remove .DS_Store files

Mac OS X: How to remove .DS_Store files

By Sudz Kar 26 comments Last updated December 27, 2019

Do you suddenly have files or icons named .DS_Store appearing in your folders or on your desktop?  And you have no idea how they got there or how to handle them? If you try and delete these particular files, they simply reappear as soon as you delete them or put them into the trash.  So, how do makes those darn .DS_Store files disappear?Mac OS X: How to remove .DS_Store files

Related Articles

  • Speed Up Your Mac with Terminal
  • How-To Fix Corrupt User Accounts
  • 10 Things For Mac Users
  • BackUp iDevice Using iTunes and Terminal

Contents

  • All About .DS_Store Files
  • Don’t Delete .DS_Store Files (unless you have a very good reason)
      • So for most of us, it’s best to just make .DS_Store files hidden once again  
  • Make Your .DS_Store files Hidden Again
    • Unhide Your .DS_Store files
  • If You Must Delete, Do It By the Book with Terminal
    • Remove all DS_Store files
    • Automatically remove DS_Store files periodically
      • Note: This command runs when your computer is either on or in sleep mode.

All About .DS_Store Files

.DS_Store (or Desktop Services Store) are hidden cache files created by Mac OS. And if they don’t exist, your OS creates them. These hidden files are automatically created by your mac’s Finder in your computer’s directories. They contain information about your system configuration and settings, such as icon size and other directory metadata. If by chance or accident, you upload these .DS_Store files along with other files, the files may release information about your computer.

Your Mac places a .DS_Store file into every folder you have open, automatically. If you suddenly see .DS_Store files and unable to get rid of them, you probably accidently activated Show All Files.  Though .DS_Store files are invisible to the average user, if you’re sharing with a Windows PC or have hidden files shown in Finder, you see them everywhere, in every folder.  You might even see a .ds_store icon on your desktop!  In all likelihood, you probably have no idea how the .DS_Store files got there in the first place, what they mean, or how to get them off your desktop or folder.

Don’t Delete .DS_Store Files (unless you have a very good reason)

If you don’t have a particular reason to delete these .DS_Store files (windows sharing might be a solid reason,) it’s best to leave them “as is.” There’s no performance benefit in deleting .DS_Store files. They are harmless files that don’t usually cause any problems. Remember that the .DS_Store file saves your personalized folder settings, such as your icon arrangement and column sortings. And that’s why you normally don’t want to delete them but rather HIDE them.

You can delete them, but they are recreated by OS anyway, primarily to store your preference information.

So for most of us, it’s best to just make .DS_Store files hidden once again  

Make Your .DS_Store files Hidden Again

  1. Launch Terminal by selecting Applications > Utilities
  2. Enter the following command: defaults write com.apple.finder AppleShowAllFiles -boolean false;killall Finder 
    1. You can also use the command: defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder
  3. Hit return, the Finder restarts and .DS_Store files (and other invisible files) are hidden againMac OS X: How to remove .DS_Store files
  4. If your .DS_Store file is still visible, relaunch your Finder
    1. Use the keyboard shortcut Option+Shift+Command+Escape OR
    2. Open Finder
    3. Click the Apple menu while holding down the Shift key
    4. Click Force Quit Finder or use the keyboard shortcut Option+Shift+Command+EscapeMac OS X: How to remove .DS_Store files

Unhide Your .DS_Store files

If you decide you want to unhide the .DS_Store File or any other invisible files, just use another (and very similar) terminal command
  1. Launch Terminal
  2. Enter the following command: defaults write com.apple.Finder AppleShowAllFiles TRUE;killall Finder
    1. Or use this command: defaults write com.apple.finder AppleShowAllFiles -boolean true;killall Finder 
  3. Press return and your Finder restarts, showing all those hidden files including .DS_Store
  4. If your hidden files or .DS_Store file did not reappear, relaunch Finder
    1. Use the keyboard shortcut Option+Shift+Command+Escape OR
    2. Hold the ⌥ (alt/option) and right-click on the Finder icon in your Dock
    3. Click Relaunch or use the keyboard shortcut Option+Shift+Command+Escape

If You Must Delete, Do It By the Book with Terminal

macOS App Store Updates Not Showing? Ghost Updates?

Remove all DS_Store files

  1. Select Applications > Utilities and launch Terminal
  2. Enter the command: sudo find / -name “.DS_Store” -depth -exec rm {} \;
  3. When prompted for a password enter your OS Administrator password

Automatically remove DS_Store files periodically

  1. Select Applications > Utilities to launch Terminal.
  2. Enter the following UNIX command: sudo crontab -e
  3. When prompted for a password, enter your OS Administrator password
  4. In the vi editor, press the letter I on your keyboard once and enter the following command: 15 1 * * * root find / -name “.DS_Store” -depth -exec rm {} \;
    1. This crontab entry has the following format: <Minute> <Hour> <DayOfMonth> <Month> <DayOfWeek> <User Command>
    2. The system automatically runs the command at 1:15 AM every day. To configure the command for a different time, use different values
  5. To save the entry, press the Esc key once, then simultaneously press Shift+Z+Z

Note: This command runs when your computer is either on or in sleep mode.

 

Related Posts:

  • 10 Best Hidden Camera Detector Apps for iPhone
    10 Best Hidden Camera Detector Apps for iPhone
  • pexels-cottonbro-5474033
    How To Navigate Folders Using The Mac Terminal
  • pexels-cottonbro-5474033
    How To Use The Mac Terminal: The Basics
  • pexels-mockupeditorcom-205316
    10 Mac Terminal Tips And Tricks For Pro Users
  • 2023 Mac Studio lifestyle – 1
    macOS Could Not Be Installed, How-To Fix
  • How to transfer files between two Mac user accounts with macOS
    How to transfer files between two user accounts on your Mac
  • Photo of someone using Apple Music on their smartphone
    How to Fix Apple Music Not Working on iPhone / iPad
  • MacBook, iPhone, and Camera Lenses
    How to Use Notes on Mac: A Complete User Guide
  • pexels-hana-mara-3650616
    The Best Homebrew Apps For Mac
sudz - apple
Sudz Kar

Obsessed with tech since the early arrival of A/UX on Apple, Sudz (SK) is responsible for the original editorial direction of AppleToolBox. He is based out of Los Angeles, CA.

Sudz specializes in covering all things macOS, having reviewed dozens of OS X and macOS developments over the years.

In a former life, Sudz worked helping Fortune 100 companies with their technology and business transformation aspirations.

Reader Interactions

Write a Comment Cancel reply

Show 26 Comments

  1. Joseph Redd says

    March 1, 2021 at 5:49 PM

    This helped my get rid of the .DS icons from my screen. Thank you!
    I’ve been using Macs from the beginning.
    In ham talk, SK means a silent key. (decease ham operator). //… Joe

    Reply
  2. Charli says

    December 23, 2020 at 11:04 AM

    I use a USB and go back and forth between a Mac and Windows computer. When my USB is connected to my macbook, I do not see the .DS_Store Files. But when I connect it to a windows computer, I see them. How do I get rid of/hide them while using my USB on a windows computer?

    Reply
  3. Dan says

    December 8, 2020 at 7:49 AM

    Thank you very much, it worked when I went into terminal and wrote:

    defaults write com.apple.finder AppleShowAllFiles -boolean false;killall Finder

    So nice to get rid of seeing those files in every folder! 🙂

    Reply
  4. schnizzlebutt says

    December 27, 2019 at 9:24 AM

    “Note: If your computer is switched off, this command does not run”

    This makes absolutely no sense.

    Reply
    • Elizabeth Jones says

      December 27, 2019 at 11:10 AM

      Because that command runs in the background and periodically, depending on the schedule you set up. So obviously, if your computer is off, it cannot run the command.

      Reply
  5. jeff says

    November 1, 2019 at 7:23 AM

    Great It worked!!!
    thank you very much ;D

    Reply
  6. Pablo says

    May 16, 2019 at 6:55 PM

    Tried 3 other websites with random commands and this one worked first time. Cheers

    Reply
  7. Jim says

    February 14, 2018 at 4:36 PM

    Thanks, this Worked!
    defaults write com.apple.finder AppleShowAllFiles -boolean false;killall Finder

    ? BTW, I didn’t try it… BUT would love to know why/how another site posted/used a slightly different string (below) without the “-boolean” and UC “FALSE”

    defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder

    Reply
    • SK says

      February 15, 2018 at 9:47 AM

      Hi Jim,

      Both commands are fine–they are variations. We include “boolean” into our command for folks using really old versions of Mac OS X, that might not recongize the short code. But I’ve added the shorter version into the article, just in case some folks are confused.

      Thanks for bringing this to our attention! And we’re glad it worked!

      SK

      Reply
  8. Lee says

    November 10, 2017 at 7:41 AM

    Thank you!! Gone in an instant with your Terminal copy and paste.

    Reply
    • Elizabeth says

      November 10, 2017 at 7:47 AM

      Yeah! Thanks for letting us know.

      Liz

      Reply
  9. designerbin says

    January 28, 2017 at 10:17 AM

    THANKS! definitely the BEST and the only one that worked! KUDOS 🙂

    Reply
  10. blub says

    December 30, 2016 at 9:45 PM

    This is the only one that worked! Thanks

    Reply
  11. alphea says

    December 5, 2016 at 5:17 AM

    A HUDGE THANKS !
    Have been trying to hide those files since yesterday and I’v finally find the right webpage to do it.
    😉

    Reply
  12. Chuck says

    July 2, 2016 at 10:03 AM

    The first time I tried it, it didn’t work. So I copied your script and pasted it into terminal. Then it worked just fine! Thanks so much.

    Reply
  13. Brian says

    April 7, 2016 at 11:58 AM

    I’ve been trying all different commands given on different forums and non have worked…..this does…..brilliant, thanks

    Reply
  14. Brandon says

    September 11, 2015 at 6:10 PM

    Does not remove the file. Only hides it. Change the title of your post to reflect this.

    Reply
  15. guru says

    September 1, 2015 at 9:11 PM

    wow…………… great thanx

    Reply
  16. Marianne says

    July 5, 2015 at 4:03 AM

    THANK YOU!!!!

    Reply
  17. Jane says

    May 11, 2015 at 2:17 PM

    This only hides them… it does not get rid of them.

    Reply
  18. Daniel says

    April 27, 2015 at 12:06 PM

    This does NOT solve the problem. The file still exists. I wish for the OS NOT to store the way I rearranged the files last. It’s a useless file to me, and supremely annoying as I would like to have all my directories default upon viewing them, instead of storing how I viewed them the last time, nor how my icons were arranged. It’s supremely infuriating.

    I want to get rid of the file, and prevent OSX from even writing the file in the first place. I do not want a file that stores nonsense that makes my life more inconvenient by having stupid “custom” views for every single different directory ever.

    Reply
  19. Jane says

    March 28, 2015 at 12:13 PM

    You don’t know how happy this makes me! It worked! I’ve been trying to find a way to get rid of those buggers forever. Gone! Can’t thank you enough.

    Reply
    • Azeria Duncan says

      June 19, 2015 at 2:05 AM

      Thank you, finally,. I appreciate you

      Reply
  20. Izumi K says

    February 7, 2015 at 11:01 AM

    THANKYOUSOMUCH!!!!!!!!!! It was driving me crazy : p

    Reply
  21. andres shahainz says

    January 6, 2015 at 9:19 PM

    WOW Thanks so much!!!!!!!!!!
    I have had a .DS_Store for about two years now and i have finally got rid o it thanks to you!

    Reply
    • Debal says

      March 6, 2015 at 6:52 AM

      But it simply does not work with my Mac.

      Reply

Primary Sidebar

Recent Posts

  • How to Fix Bad AirPods Sound Quality on PC
  • Use This Trick to Sync Apple Notes and Microsoft Word
  • How to Run Android Apps on a Mac
  • What Is the Best iOS Emulator for Windows PCs?
  • How to Remove Personal Info From Word Doc (Mac)
  • How to Share Files Between iPhone and Android

Connect with us

Footer

ABOUT

  • About Us
  • Contact us
  • Advertise
  • Privacy
  • Terms of Use

GUIDES

  • iOS & iPadOS
  • Apple ID
  • iCloud
  • App Store
  • iTunes
  • FaceTime
  • iMessage
  • Siri
  • Books and iBooks
  • Game Center
  • AirPlay

CONNECT

  • Facebook
  • Twitter
  • FeedBurner
  • YouTube

© Copyright 2010-2024 Guiding Tech Media · All Rights Reserved

This site and its content are in no way affiliated or endorsed by Apple, Inc. · Reproduction without explicit permission is prohibited

Last Updated on December 27, 2019 by Elizabeth Jones