Delete All .DS_Store Files from Mac OS X

Jul 5, 2012 - 35 Comments


DS_Store files are hidden system files that reside within almost every folder of Mac OS X, they contain folder-specific information and settings, like what view to use, icon size, and other metadata pertaining to their directory.

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’ll see them in every folder, and if you’re trying to force a change like which view to use across all directories in Finder, you may discover the .DS_Store files are in the way, thus it’d be reasonable to want to delete and remove ds_store files on a Mac.

The method described below will delete every single DS_Store file from a Mac OS X volume. As usual with the command line, it is for advanced users only, it is critical that you enter the syntax exactly as written otherwise you could delete other files. Backup your Mac before running these type of commands.

How to Delete All DS_Store Files from a Mac

  1. Launch Terminal, found in /Applications/Utilities/
  2. Type the following command exactly:
  3. sudo find / -name ".DS_Store" -depth -exec rm {} \;

  4. Enter the administrator password when asked – it won’t be visible when typing which is standard for the command line
  5. Let the command run, it will find all instances of .DS_Store and delete them

DS_Store Files in Mac OS X

You can also go a step further and use a defaults write command to disable .DS_Store creation which can help to avoid clutter on networked drives.

If your annoyance with DS_Store stems from networking, you may notice that Windows PC’s have similar metadata files in all directories called “Thumbs.db“, those can also be removed separately by using Spotlight.

This is a handy tip from Adobe, of all places. Adobe also shows how to use crontab to schedule the deletion of .DS_Store files, but if you delete them once and disable their creation you shouldn’t need that functionality. Thanks for the tip idea Andy!

If you know of any other handy tips for managing and dealing with DS_Store files then share them in the comments below!


Related articles:

Posted by: William Pearson in Command Line, Mac OS, Tips & Tricks, Troubleshooting


» Comments RSS Feed

  1. Akshay says:

    If you want to delete within a dir, use .

    1. See if these are the right files/dir to delete
    sudo find . -name “.DS_Store” -print

    2. Delete them
    sudo find . -name “.DS_Store” -exec rm {} ;

    3. Check if they are deleted
    sudo find . -name “.DS_Store” -print

    I do above steps before making an archive
    Yes i agree with this answer

  2. Jaydeep says:

    Hii DS_Store files are not visible in my Mac, but whenever I upload a zip file (with multiple folders inside) on Google Drive, DS_Store files appear in each and every folder.
    And, how long does the execution of copy-paste thing take in the terminal?
    I also tried to copy and paste but doesn’t valid please solve the issue.

  3. Genton says:

    I performed the terminal process and then I couldn’t launch applications so I decided to reboot. Now the Mac won’t boot. Won’t boot into safe mode either. It at the gray screen with the apple logo showing with the spinning icon. I’m going to just let it sit awhile since the terminal function took really long. Mac OS 10.4.11 PowerMac G4 FW800

    • ds says:

      You might want to restore from a recent backup made with Time Machine prior to issuing the command. If you did not enter the syntax exactly as written then you may have incorrectly deleted something you did not intend to. For example if you deleted a system folder or a system component then the Mac won’t boot. sudo gives superuser privilege to delete anything with the ‘rm’ command, which is why the syntax must be correct to match the “.DS_Store” matched files only.

      The command comes from Adobe they wrote it such that syntax must be precise, but that’s typically the case with most command line stuff too.

      You could also boot from a boot disk to reinstall Mac OS.

      Removing .DS_Store files should have no impact on boot if done properly.

      If you are seeing a spinning globe, it’s likely trying to boot into Internet Recovery.

      • Genton says:

        Thanks for the reply ds. It’s still trying to boot. Looks like nearly 3 hours now. I think it’s safe to say that I will need to resolve the boot issue now. I have installer disks for os 10.4. Can’t open the tray with the keyboard but maybe I can format a USB and try that. I think I did that once a long time ago. I’ll post results but might not be today.

      • Genton says:


        I was able to boot from CD using the option key upon startup. Thank goodness! I don’t have anything important on the drive so wiping it is no big deal. Well, lesson learned on this one! I read some more information online about networking and found out that HFS file system on that last few OS’s that Apple put out changed to APFS. There is no longer any way for the G4 to talk to the intel iMac. The iMac reads the G4 but not the other way around. There is a file that someone created so that the G4 can read but not write to the iMac. I’ll skip even trying that. LOL Thanks for the assist though. Much appreciated.

  4. hkChaos says:

    If you want to delete within a dir, use .

    1. See if these are the right files/dir to delete
    sudo find . -name “.DS_Store” -print

    2. Delete them
    sudo find . -name “.DS_Store” -exec rm {} \;

    3. Check if they are deleted
    sudo find . -name “.DS_Store” -print

    I do above steps before making an archive

  5. Ellis says:

    I was trying to do this to repair some corrupt .MOV files and afterwards everything on my external was deleted. Obviously I had no business messing with this stuff and now I’m screwed. Is there any way I can recover these files?

  6. Giles says:

    It keeps running after the above notes, but then it stops with this:
    override rw-rw-r– root/admin for /Volumes/Backup Space/Backups.backupdb/GB’s G4 PB/2015-12-16-185712/Hard Drive/.DS_Store?

    I don’t know how to answer this.

  7. Giles says:

    When I try this operation I get:

    find: /dev/fd/3: Not a directory
    find: /dev/fd/4: Not a directory

  8. Johan says:

    The .DS_Store files are very annoying in copy operations.
    For example, I have 2 WD MyCloud 4 TB drives containing media files. Both drives are used as media server and serve the users in our household, in this case it was not an option to format the drives as dedicated Mac drives. When I start rearranging the media files I ended up in frustration because the .DS_Store files stopped copy and/or moving operations.

    I found on the internet a handy little Windows app (Ultracopier for Windows – that does the job. if it encounters file doubles it will ask you what to do with the file (replace-skip….) this little app saved my day.

  9. JAMES says:

    Whats the Password for DS-STORE????

  10. Pramesh says:

    Hey, the .DS_Store files are not visible in my Mac, but whenever I upload a zip file (with multiple folders inside) on Google Drive, .DS_Store files appear in each and every folder.

    How may I solve this issue? I tried the “copy-paste this line” thing but it doesn’t seem to work.

    And, how long does the execution of copy-paste thing take in terminal?

  11. Christer says:

    Robert: Yes: Copying files between disks in a network (NAS) is a big problem.
    Using the new thunderbolt disks (DAS) as a substitute for those slow connections (NAS), is an ever greater problem.
    As these disks are treated as local disks, there is no way of stopping the DS_Store creations.
    The basic problem is the way Finder copies maps.

    This is one way of getting the error:
    1. Create a map and fill it with data in/on a NAS.
    2. Create some a local map with som extra maps.
    3. Look into these local maps to create DS_Store files.
    4. Copy te top local map into the NAS-map
    5. Copy the top NAS-map back to a local USB-disk.
    6. Move this USB-disk to another computer.
    7. Copy the USB-disk content back to a thunderbolt disk.
    ==> It will not work as the a “DS_Store” file already exists. !

    This is getting furious, as…
    even as you can find the problem, you can’t do anything to solve it !!!

    We need a simpler handling from Apple to show and fix this utterly annoying problem.

  12. Robert says:

    Rubbish. Ds_Store files cause a huge problem.

    If, like me, you try to copy a large number of files from one external hard drive to another it fails because of Ds_Store files.

    The copying process stops. So you come back to your mac having waited ages and lo and behold, it hasn’t done what you want. It simply stops the copying process. Completely hopeless.

  13. MisterSoushi says:

    I put the code in and the password came out and I can’t type my password or any other letters. All I can do is press the enter button and that didn’t help at all.

  14. Vlad Didenko says:

    You may want to explain your users when to use the -x option. Otherwise scanning mounted shares may take forever.

  15. mikey says:

    Do NOT delete these if you are just using your OS X system, or shares on your network. (You can delete them, if they are only held on a non-OS X system, eg. Win.)

    a) They actually do a job.
    While it’s an *aspiration* that Apple use “extended file attributes” for these current per-folder settings; they are NOT yet! Hence Finder needs these files to keep Spotlight data and all your other folder settings you have set as a user yourself, actually working.

    b) They get re-created anyway by Finder/PathFinder.

    c) They are harmless.
    And while they seem like cruft, they’re not on OS X: they do a job.
    They do not override folder specific settings, unless you *specifically ask them to* by using OS X’s GUI (or command line) to do so.

  16. James Ludtke says:

    I some times zip folders for transmission to Windows users. How can I delete the .DS file in just that folder before zipping it. I suppose that if I do not change any windows setting before zipping, the.DS file is not recreated in that folder.

  17. Pedro says:

    Toke me some time but now all is restored ehhe
    Good think i noiticed what was happening fast xD

  18. Lauri Ranta says:

    As Chris said, the -depth option isn’t needed.

    OS X’s find also has a -delete flag:

    sudo find / -name .DS_Store -delete

    > An advice, copy-past the command line…
    > I typed it myself and forgot the -name and now everything got deleted………… my god :X

    This should be repeated, don’t forget the -name flag.

  19. Jeff says:

    There’s an app for that:
    (free on the mac app store)

    I wouldn’t recommend non technical people to execute:
    sudo find / -name “.DS_Store” -depth -exec rm {} \;
    It is asking for trouble…

  20. Chris says:

    You might also want to do this for ._.DS_Store files as well (I’ve noticed a lot of these on network drives).

    Find also runs a lot faster if you allow its exec routine to group multiple files into the same command with \+ instead of \; E.g.

    find / \( -name .DS_Store -o -name ._.DS_Store \) -exec rm -f {} \+

    The -depth flag is unnecessary in this use case.

  21. Bruno Gama says:

    there’s no reason to do that, finder will recreate everything.

    but, if you are justifying to delete ds_store because the windows sharing, erase all files from your local user (~ instead /) or the shared folders in the network.

    you could even create a cron or launchd task to do the job.

  22. Tony says:

    This may seem like a silly question but I am a relatively new user to OSX and am wondering what the purpose would be in deleting these files other than some housekeeping which I am all for. Are there any performance benefits etc?

    • Will says:

      If you don’t have a compelling reason to delete these files (primarily, networking with a lot of Windows PC’s), you do not need to do so. There is no performance benefit and they are recreated by OS X to store preference information.

      Definitely not necessary for 99% of users.

  23. Mark says:

    Or just use dot_clean which was designed for this on the root of the drive.

  24. Alberto I says:

    What is the meaning to delete these? They will be recreate after a restart or o relog, no?

  25. Pedro says:

    An advice, copy-past the command line…
    I typed it myself and forgot the -name and now everything got deleted………… my god :X

    • Ellis says:

      I copy-pasted and now all my files were deleted. How did you recover them?

      • Todd says:

        You wanted to delete the .DS_Store files, so you deleted them, and now you want them back? What were you expecting to happen? What a strange thing.

        You can use Time Machine to restore your DS_STORE files if you want them back, or let them regenerate on their own.

        The tip from Adobe Software Inc to use sudo and rm is not the best idea. And if you don’t know the command line, don’t ever use it. Period.

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site