Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

schwine1

macrumors regular
Original poster
Sep 13, 2008
183
4
How can I hide or make invisible DS_Store files within folders on Mac OS X El Capitan (version 10.11.5)?
I've tried copy and pasting the script below in Terminal, and the DS_Store files are still visible.

Note that the DS_Store files in question are recovered files from a damaged hard disk that are now on my main Mac computer (Mac Mini, 2014). The folders in the recovered files have the visible DS_Store files, whereas all other folders on the Mac Mini do not have "visible" DS_Store files.

Thanks for any tips on how to make DS_Store files invisible in the recovered folders.

Terminal script:
defaults write com.apple.finder AppleShowAllFiles NO
killall Finder
 
Last edited by a moderator:
I've tried manually typing the above script in Terminal with NO and the DS_Store files are still visible.
Is there another way to make the DS_Store files invisible?
 
I've tried manually typing the above script in Terminal with NO and the DS_Store files are still visible.
Is there another way to make the DS_Store files invisible?

You are probably better off asking this question in the OSX discussion board as opposed to the Mini. This tends to be more hardware related discussions and not software.....
 
Instead of FALSE it should be NO if I am correct, this changed somewhere in the past.

Yep... I just tested in El Capitan and this will hide them.

Code:
defaults write com.apple.finder AppleShowAllFiles -bool NO

Code:
killall Finder
 
You can also try toggling that invisibility command.
run with a Yes first. Restart, then run again with a No.
(You don't need a restart, but simply something that I do when running that command)

If that doesn't work, then you may need to use a chflags command. I'm kinda guessing on that one...
 
I use Onyx's Finder tweaks to show/hide DS_Store files, and Restart as well.
 
The visible DS_Store files are located on an external drive that is connected to a Mac Mini.
Is there a way to make the external drive DS_Store files invisible? Thanks.
 
Sounds like the files are misnamed. There should be a dot in front of them to make them invisible. In other words, they should be named ".DS_Store" not "DS_Store".

With the dot in front they will be invisible when the drive is connected to a Mac, but not when it is connected to a PC.
 
Please do the following:

  1. Open Terminal.
  2. Type the following:

    ls -leOdn
  3. Type a space.
  4. Drop one of the unhidden files onto the Terminal window.
  5. Click on the Terminal window and then press return.
  6. Include the contents of the Terminal window in a reply to this post.
 
Just delete them. DS Store files are nothing critical anyway—they just store the preferences for that particular folder's View settings.

If you recovered them from a damaged HD, they're probably corrupted anyway.
 
This should stop creation of them on external mounted drives:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

And this will delete all of them on your entire system, drives included if they are connected.

sudo find / -name ".DS_Store" -depth -exec rm {} \;

As already mentioned they are not critical and only store file view, icon data, which is recreated when you go back into the folder system.
 
Just delete them. DS Store files are nothing critical anyway—they just store the preferences for that particular folder's View settings.

If you recovered them from a damaged HD, they're probably corrupted anyway.
Yes, I think the files may be corrupt since they read as DS_Store as opposed to .DS_Store.
That is, since the dot in front of .DS is the proper form for this file, and the dot is not present in the recovered files from the damaged hard disk.
 
This should stop creation of them on external mounted drives:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

And this will delete all of them on your entire system, drives included if they are connected.

sudo find / -name ".DS_Store" -depth -exec rm {} \;

As already mentioned they are not critical and only store file view, icon data, which is recreated when you go back into the folder system.

After I type in this sudo command in the Terminal window, a warning message appears and asks for my password.

The problem is that after the warning message appears in the Terminal window, I am not able to type in my password. The reason is that the mouse curser is not seemingly allowed to appear in the Terminal window after the warning message appears. It's as if the Terminal window gets frozen for some reason, and I've tried the process a few times now with the same result. I'm already in my Administrator account, and I even logged out and logged back into my Administrator account, but the same warning message appears, and I am unable to type in my password for the reason just noted. This sudo command may solve the problem, but getting Terminal to accept the command seems challenging.
[doublepost=1466568778][/doublepost]
Please do the following:

  1. Open Terminal.
  2. Type the following:

    ls -leOdn
  3. Type a space.
  4. Drop one of the unhidden files onto the Terminal window.
  5. Click on the Terminal window and then press return.
  6. Include the contents of the Terminal window in a reply to this post.

Here are the contents of the Terminal window as requested.
Most of the DS_Store files on the external drive are associated with mp3 music files.
------------------------------------------------------------------------------
Last login: Tue Jun 21 21:42:38 on ttys000

-mac-mini:~ $ Is -IeOdn /Volumes/External\ Drive/My\ Documents/sound\ files/06\ music\ sets/Music\ Sets/04\ sets \ artists/DS_Store

-bash: Is: command not found

mac-mini:~ x$ ghchv
 

Attachments

  • terminal password issue.jpg
    terminal password issue.jpg
    66.5 KB · Views: 460
Last edited:
Firstly, don't use randomgeeza's command because it contains errors. Do the following instead:

  1. In Finder, press shift-command-C.
  2. Open the volume that contains the unwanted files.
  3. Press command-F.
  4. Enter the following into the search field and then press return:

    name:DS_Store
  5. Select one of the unwanted files and then press command-A.
  6. Press option-command-delete and then press Delete.

The problem is that after the warning message appears in the Terminal window, I am not able to type in my password.

In Terminal, most password prompts don't show your input to prevent others from discovering the length of your password.
 
Last edited:
Just to reinforce what richard2 posted:
When typing the password in the terminal, you will NOT see any response in the terminal as you type your password, it is a security feature of the terminal. So, just type your password, then press enter. That will work :D
 
Firstly, don't use randomgeeza's command because it contains errors. Do the following instead:

  1. In Finder, press shift-command-C.
  2. Open the volume that contains the unwanted files.
  3. Press command-F.
  4. Enter the following into the search field and then press return:

    name:DS_Store
  5. Select one of the unwanted files and then press command-A.
  6. Press option-command-delete and then press Delete.
Thanks richard2. Your instructions worked perfectly.
This process was helpful since there were almost 4,000 visible DS_Store files to delete. Thanks again.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.