Remove .Ds Store Files on Mac Os X

Revision as of 03:22, 9 January 2016 by Kipkis (Kipkis | contribs) (importing article from wikihow)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 the Finder window, window backgrounds plus many more properties but are hidden from the user's view.

.DS_Store files can become corrupted and cause Finder to behave oddly when you open the folder that contains it. Corrupted .DS_Store files cause problems like a Finder window blinking open and then closing, the inability to see some icons, or sort icons, or to change the view options.

Steps

  1. To delete a corrupted .DS_Store file you will need to use Terminal.app. To do that you must be logged into Mac OS X as an administrator.
  2. Open Terminal.
    • Open a new finder window and navigate to the Applications folder on the left. (Alternately, when it says 'Finder' beside your Apple in the top left hand corner of the screen, select the 'Go' menu and click 'Applications'.)
    • Inside the Applications folder near the very bottom is the 'Utilities' folder. Open that folder.
    • Find and double-click the 'Terminal' application with the left mouse button to open it.
  3. Give yourself super-user (root) permissions in Terminal so you can use the commands needed to delete some .DS_Store files. This is done using the 'sudo' command (Switch User and Do).
    • In terminal type the following sudo ls (all lowercase) and hit [Return] on your keyboard.
    • Terminal will prompt you for a password Use your administrator account password. If you don't have a password, leave it blank. [NOTE: For security reasons, unlike Windows, Mac OS X won't show any sign that you are typing your password, just type normally, even though nothing shows.]

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.
    • 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'.
    • 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.
    • Type cd in terminal followed by a space
    • 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.

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. 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.

Tips

  • Breakdown of Terminal commands used in this document
    • sudo ls
      • sudo : Stands for 'Switch User and Do'. This causes anything typed after it to be executed from the most powerful account on the computer (Root) essentially making it so permissions and access denied error messages will not get in your way. In Mac OS X this remains in effect until you close and reopen Terminal.
      • ls : Stands for 'List' and makes Terminal list all of the files and folders in the current directory. We simply used this so we had something non-invasive trailing the sudo command.
    • cd
      • cd : Stands for 'Change Directory' and is used to navigate around the folder structure of the computer.
      • The path : Is where we want to navigate to. Some shortcuts include: ~ for the home folder of your currently logged in user and / for 'Macintosh HD' [ie. cd ~ is the same as cd /Users/<your name="">]
    • rm -f <file>
      • rm : Stands for 'Remove' and is used to delete files.
      • -f : This is called a flag and is used to modify a command. In this case, it tells the rm command to force it to happen (ignore permissions, and objections). If we wanted to delete a folder we would need to use the -r flag as well which means to be recursive (i.e., delete everything inside so BE VERY CAREFUL WITH THE -r flag!).
      • The File : This is the file to be deleted.

Warnings

  • .DS_Store files do not contain anything vital and can be deleted without fear of serious repercussions. Finder creates its contents as needed. The same cannot be said for everything in the operating system. Do not delete files if you do not know what they do.
  • Terminal.app is an application that works entirely on text based input. A simple misspelling or accidental keystroke in Terminal can have serious consequences. Follow well documented Mac OS X Terminal procedures until you know what you are doing.

Things You'll Need

  • Mac OS X 10.0 or newer.
  • An Administrator account and password.

Related Articles