How to Remove .Ds_Store Files on Mac OS X

The Finder automatically places a .DS_Store file into every folder you have opened. .DS_Store files are created by the Finder during its normal course of operation. These files hold view options, including the positions of icons, size of...
Method 1 of 2:

Navigate to the Folder with the Corrupted .DS_Store File

You must now navigate to the folder with the corrupted .DS_Store file or this procedure won't correct your problem (unless it's the folder where terminal naturally opens, usually your home folder. There are two methods to accomplish this task.

  1. Method 1: Use the 'cd' (Change Directory) command along with the path to the folder in need of repair.
    1. To translate what you do in Finder to a written path, start by clicking 'Macintosh HD' on your desktop. This will become '/'. Click the next folder. The name will follow the '/' so type another '/' before any more folder names. For example, if the folder you are having issues with is 'Macintosh HD' -> 'Applications', the path to this folder is '/Applications'. If the problem folder was the 'Utilities' folder inside 'Applications', the path would be '/Applications/Utilities'.
      How to Remove .Ds_Store Files on Mac OS X Picture 1How to Remove .Ds_Store Files on Mac OS X Picture 1
    2. Type cd /path (example: cd /Applications) then press Return.
  2. Method 2: We can use the 'cd' command and drag the folder to terminal which automatically completes the path building process for you.
    1. Type cd in terminal followed by a space
      How to Remove .Ds_Store Files on Mac OS X Picture 2How to Remove .Ds_Store Files on Mac OS X Picture 2
    2. Find the folder with the issue but DON'T OPEN IT, drag its icon into terminal. Watch it complete the path for you. Press Return.
Method 2 of 2:

Delete the .DS_Store File

You can now remove the .DS_Store folder and all its contents with one very powerful command. The 'rm' (Remove) modified by '-f' removes all files and folders contained in the target name. DO NOT MIS-TYPE this command.

  1. How to Remove .Ds_Store Files on Mac OS X Picture 3How to Remove .Ds_Store Files on Mac OS X Picture 3
    Type rm -f .DS_Store and press Return. Terminal will ask for no confirmation and give no indication that this has been completed - it will only return a message if the command did not work.
  2. You should now be able to navigate to the folder in finder and the issue should be corrected.
4.5 ★ | 2 Vote