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:
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.
- 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.
- 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'.
- 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.
- Type cd in terminal followed by a space
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.
- 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.
- You should now be able to navigate to the folder in finder and the issue should be corrected.
Update 04 March 2020
You should read it
- A simple way to delete a folder with a long name on Windows
- How to Map a Folder to a Drive Letter in Windows
- Copying file and folder paths in File Explorer is now much simpler on Windows 11
- How to Set the Path in Java
- How to completely hide a folder with a single command on Windows
- How to change the default Download path on Windows?
- How to Rename the User Folder on Windows
- Use CMD to create an 'undeleted' folder on Windows
- How to Open Folders in CMD
- Change all file extensions in a Folder with the CMD command
- How to open a folder on a Mac using a command in Terminal
- How to Change Directories in Command Prompt