Fix OS X crashing when a particular folder is opened

FinderIconYosemiteXDoes OS X sometimes crash when you open a particular folder? While such occurrences are fairly rare, there may be instances where the Finder runs run into problems when handling a specific folder, and then either hang and display the spinning color wheel, or have the Finder crash and re-launch. If such problems are happening, then after ensuring you have a full and restorable backup of your system up to date, there are a couple of fixes you can try.

Filesystem Errors

The first possible cause for this error is a fault in your Mac’s hard drive, where an error in the data structure on it may cause a hang when a specific node is accessed, or at least accessed by specific applications like the Finder. To test your drive for such problems, first use Disk Utility to verify the drive’s filesystem structure:

  1. Open Disk Utility
  2. Select the volume containing your problem folder
  3. Click the Verify button in the First Aid tab

If any errors show, then first see if you can make a full backup of your hard drive with Time Machine, and then use the Repair button to attempt fixing the drive. If the repair button is faded out, then you will need to boot your Mac into Recovery Mode (hold Command-R at startup) and use Disk Utility from there.

If you do find extensive problems with your drive’s formatting, and using Disk Utility’s repair options does not work, then your best approach is to format your hard drive and restore your Mac to your latest Time Machine backup.

Another possibility is this may be an issue with the specific folder and how it is represented to the system, and not the contents of it. In this case you can try bypassing the Finder to access the folder’s contents and move them to a new folder:

  1. Create a folder on your desktop called “Backup”
  2. Open the Terminal utility, and then type “sudo mv ” followed by a single space
  3. Drag the faulty folder to the Terminal window, but then delete the trailing space
  4. Type “/* ~/Desktop/Backup/” to complete the command, and press Enter

After supplying your password when prompted (it will not show), this procedure will instruct the system to move the contents of the folder to the new Backup one on your desktop. If you do not receive any errors when doing this, and all the contents of the folder are in the Backup folder, then you can try removing the faulty folder to see if that clears the problems you are experiencing.

.DS_Store file errors

One potential issue here is that you might have a problem with the hidden “.DS_Store” configuration file in the faulty folder. The .DS_Store file contains the particular view settings for a folder, and will load them when the folder is opened. If loaded in an existing Finder window, the .DS_Store’s settings will combine with those from the parent directories. If a fault is present in this file, then opening the Finder window may cause it to hang or crash.

To fix this issue, you can either try overwriting the .DS_Store file, or delete it and have it be re-created when the folder is next opened.

To overwrite the file, go to the parent folder and then select the folder and press Command-C to copy a reference to it. Then close all finder windows so only the Desktop is showing, and then press Shift-Command-G to bring up the “Go to Folder” window. In here paste the copied folder reference (only its name will show, and not a full folder path) and press Enter to open it. This should force the Finder to load only this folder and its settings, as opposed to managing any inheritance of settings from parent folders.

If the folder opens successfully, press Command-J to bring up the views panel and adjust some settings, along with resizing and repositioning the window. These actions should have the Finder write to the .DS_Store file and hopefully overcome whatever problem with it is spurring the issue at hand.

If the problem persists, then you will need to remove the file:

  1. Open the parent folder in the Finder
  2. Open the Terminal utility
  3. Type “rm ” followed by a single space
  4. Drag the target folder to the Terminal window (or press Command-V to paste the previously copied folder reference).
  5. Delete the trailing space in the Terminal and type “/.DS_Store”

If you get an error message in the Terminal about not having access to the file, then run the command “sudo !!” to immediately re-run the previous command but with Administrative permissions (you will have to authenticate, but your password will not show when typed). When done, open the folder in the Finder, and a new DS_Store file will be created.