How To Make Spotlight Index Your Sparse Bundle

How To Make Spotlight Index Your Sparse Bundle

Mac OSX Pretzel

If you are using a Mac, you may have decided to be security conscious and store your documents in an encrypted sparse bundle.

This is a secure disk image that you create on your computer, and to simplify a great deal, you treat it like a drive and save documents and other files to it. You need a secret password to open it, and if someone gets a hold of your computer, they can’t get at your documents unless they know the password.

Some readers have run into problems whereby the contents of their sparse bundle is not being indexed by Spotlight. This is a problem if you want to be able to search the contents of your searchable PDF documents or tags, and is especially a problem if you use something like Yep that relies on Spotlight to find your files.

Awesome DocumentSnap reader Mark ran into this problem and worked with Ironic Software support to find the solution. He was kind enough to share it with me, so I am posting it here in case anyone else is running into it.

To fix it, you need to manually tell Spotlight to index your sparse bundle. It’ll take some Terminal-fu, but it is not too bad.

  1. Mount your sparse bundle
  2. Open Terminal either by going to Spotlight and typing Terminal or by navigating to /Applications/Utilities/Terminal
  3. In the Terminal window, type the following: mdutil -i on, then a space, and then either type the path to your Sparse bundle or just drag and drop its icon into the Terminal Window.
  4. Hit Enter and it should hopefully say Indexing Enabled

For example, here is what my Terminal window command looks like:

Spotlight Sparse Bundle Index Terminal Window

If you find that Spotlight isn’t finding the contents of your Encrypted Sparse bundle the way that you think it should, give this a try.

(Photo by oskay)

About the Author

Brooks Duncan helps individuals and small businesses go paperless. He's been an accountant, a software developer, a manager in a very large corporation, and has run DocumentSnap since 2008. You can find Brooks on Twitter at @documentsnap or @brooksduncan. Thanks for stopping by.

Leave a Reply 14 comments

Steve - July 6, 2015 Reply

Yay! Converted from encrypted sparseimages to sparsebundles. Don’t know why, but some time thereafter, only filenames were being found by Spotlight. I tried to reindex by using the Privacy window in Spotlight System Preferences, but that didn’t work. This fixed my issue.

Brian W - October 30, 2013 Reply

Thanks so much for this – I was testing the new tagging feature in Mavericks and it was driving me crazy that I was able to tag files, but not use any of the search functions to find them. After using mdutil, all is well.

    Brooks Duncan
    Brooks Duncan - October 30, 2013 Reply

    Great! Good to know it helps with Mavericks tags too.

chuckles - January 8, 2013 Reply

This worked great with my Sparse Disk image in OS X 10.8.2 but after a few months the indexing became disabled and I was unable to enable indexing again with the mdutil command. Turned out that my sparse disk image file had been marked with a quarantine flag, for which Spotlight will not enable indexing.

The solution was to
– unmount the sparse disk image
– from terminal reset the quarantine flag:
xattr -d com.apple.quarantine <full_path_and_name_of_sparse_disk_image_file>
– mount
– use mdutil to enable indexing

    Brooks Duncan
    Brooks Duncan - January 8, 2013 Reply

    Weird, thanks for the report chuckles!

    Micha - March 6, 2013 Reply

    … after month of trying to solve this thing your advice CHUCKLES finally helped. GREAT!

seasharp - October 18, 2012 Reply

It worked GREAT. What a life saver.

    Brooks Duncan
    Brooks Duncan - October 18, 2012 Reply

    Great! Glad it helped.

LucB - July 26, 2012 Reply

Had this problem as well. A quick email to Brooks and he sent me a link to this post. Thanks so much!

    Brooks Duncan
    Brooks Duncan - July 26, 2012 Reply

    Glad it worked Luc!

avedus - June 25, 2012 Reply

Thank you for this posting. I looked for this solution a long time. I think that Spotlight build the new Index IN the encrypted Sparseimage; If this is true there is no new security-problem.

    Brooks Duncan
    Brooks Duncan - June 25, 2012 Reply

    Great, thanks for letting me know avedus.<p style=”color: #A0A0A8;”>

DocumentSnap Time Machine | Tips To Learn How To Go Paperless | DocumentSnap Paperless Blog - May 13, 2012 Reply

[…] How To Make Spotlight Index Your Sparse Bundle If you have your documents stored in an encrypted sparse bundle on your Mac, you may need to do this to have Spotlight index them. […]

Jim - December 15, 2011 Reply

I seem to remember recently reading (don't remember where) a discussion about indexing Truecrypt encrypted volumes. The question arose, do you really *want* to do so? The potential problem is that even when the volume is un-mounted, the index can still be used to "peek" at encrypted files, which may be a significant security risk.

Leave a Reply: