Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

thousands of files in /Library/Keychains

On a Mac mini I have the problem that I can't access the /Library/Keychains folder any more as finder it is trying to update the folder view forever. In the terminal window even a ls takes forever (+8 hours) with no result (just blinking cursor). A CCC clone could not be finished successfully, even after +10 hours it is just copying files like login.keychain_HX98DHT (don't remember exactly, but there are thousands if not millions of these).

Volume and Disk repair have shown no issues - all green.


Here are the questions:


  • What could have been causing this?
  • What can I do to resolve this?
  • Is there a way to delete this folder w/o having to enter it?
  • Is it safe to remove the keychain folder completely? (no important passwords have been stored there so we do not rely on any info in there)


Thanks to all in advance!

Mac mini, Mac OS X (10.7.5)

Posted on Dec 1, 2012 9:56 AM

Reply
Question marked as Best reply

Posted on Dec 1, 2012 11:47 AM

See if the Disk is issuing any S.M.A.R.T errors in Disk Utility...


http://support.apple.com/kb/PH7029


I've never tried removing the whole folder, yet it can be done.


In 10.4.11, I only have 2 files in my /Library/Keychains folder...


.fixed

System.keychain


But 4 in /System/Library/Keychains/


And 4 in /Users/MyUserName/Library/Keychains/


Be very careful with these commands, but in Terminal do...


man rm


And...


man rmdir


Likely you'll need to use sudo with it.

19 replies
Question marked as Best reply

Dec 1, 2012 11:47 AM in response to kingsx

See if the Disk is issuing any S.M.A.R.T errors in Disk Utility...


http://support.apple.com/kb/PH7029


I've never tried removing the whole folder, yet it can be done.


In 10.4.11, I only have 2 files in my /Library/Keychains folder...


.fixed

System.keychain


But 4 in /System/Library/Keychains/


And 4 in /Users/MyUserName/Library/Keychains/


Be very careful with these commands, but in Terminal do...


man rm


And...


man rmdir


Likely you'll need to use sudo with it.

Dec 1, 2012 12:07 PM in response to BDAqua

BDAqua, thanks for jumping in!


The SMART state is OK, no issues here whatsoever.


I've never tried removing the whole folder, yet it can be done.


What do you mean here? Do you mean it's possible to delete it or when deleted it will not have an impact on the overall system functionality?


Let me ask this a bit more precisely: Will the folder be recreated when I use the keyring again or do I need to do it manually to make the keyring function working again.


(I have just checked how many files I have on the system: 2.851.879 - isn't this waaay too much for a standard office and CS5.5 mac or am I wrong here?)

Dec 1, 2012 12:22 PM in response to kingsx

In 10.4.11, I have 2, 399,653 files, & won't be on 10.6/10.7/10.8 for about 12 more hours, but as I recall the higher OS versions had way more files.


Will the folder be recreated when I use the keyring again or do I need to do it manually to make the keyring function working again.

I'm not sure what effects not having done it, but I suspect it'll be recreated, if not, reapplying the OS Install should do it.

Dec 1, 2012 11:30 PM in response to Linc Davis

Linc Davis wrote:


Is this the keychain folder in your home library?

Yes, when I try from ~/Library/Keychains to sudo rm -R login* I get after some hours "rm - too many arguments"

If I try from ~/Library to sudo rm -R Keychains I get instantly "directory not empty"


BDAqua wrote:


I was wrong, 10.7.5 reports 1,035,172 files.


So something seems messed up on yours.


So now I know that I was on the right track, but what should I do? I'm quite lost... :-(


Message was edited by: kingsx (typos)

Dec 2, 2012 12:14 AM in response to kingsx

WE be confused together! 😉


To remove everything in a directory without removing the directory, type in:

rm -rfv dontDeleteMe/*

Please note, the

/*
part is very important. If you put a space before the
*
, it will delete all your files in your current directory.

Also, be very careful playing with

rm
,
-r
and
*
all in the same command. They can be a disastrous combination.

http://askubuntu.com/questions/72446/how-to-remove-all-files-and-subdirectories- in-a-directory-without-deleting-the-d

Dec 3, 2012 7:23 AM in response to kingsx

Now, here's the problem in short:


  • too many files for a "ls"/"chmod"/"rm"
  • "rm" the directory gives me "permission denied" errors
  • I have found out meanwhile that these files seem to be mdworker sandbox files which I have leaned from this thread: https://discussions.apple.com/thread/4145842?start=0&tstart=0
  • "rm" these from the terminal on recovery partition - same result. just doesn't work.


What I have tried was to chmod just a bunch of these files like "sudo chmod -R 777 Keychains/login.keychain.sb-18a3401f-2*" and then afterwards the same with rm - this worked but will take weeks as there are about 1.5 Million files.


Is there no way to just erase a directory with all content regardless of what's contained?


I honestly do not feel like erasing the disk to restore fom my CCC disk...

Dec 3, 2012 8:15 AM in response to kingsx

First, do not make up shell commands on your own.


You need to fix the permissions of your home folder.


Back up all data now.

This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. If none of this is meaningful to you, you don't need to worry about it.


Step 1

Launch the Terminal application in any of the following ways:

☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)

☞ In the Finder, select Go Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.

☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.

Drag or copy — do not type — the following line into the Terminal window, then press return:

sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:20 ~ $_ ; chmod -R -N ~ $_ 2> /dev/null

Be sure to select the whole line by triple-clicking anywhere in it. You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. You don't need to post the warning. If you don’t have a login password, you’ll need to set one before you can run the command.

The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.

Step 2


Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.

When the OS X Utilities screen appears, select Utilities Terminal from the menu bar. A text window opens.

In the Terminal window, type this:

resetpassword

That's one word with no spaces. Then press return. A Reset Password window opens. You’re not going to reset a password.

Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.

Select your username from the menu labeled Select the user account if not already selected.

Under Reset Home Directory Permissions and ACLs, click the Reset button.

Select  Restart from the menu bar.

Then run the shell command I posted earlier by dragging or copying it, not by typing. It needs to be modified in the light of the information you posted afterwards:

find Library/Keychains -type f -name *.sb-* -delete

thousands of files in /Library/Keychains

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.