I have a set of Smart Folders in High Sierra that index documents on a USB hard drive.

The Smart Folders are saved on the USB drive and they work.

I have moved the whole content including therefore the Smart Folders on another USB drive and they have stopped working.

I have opened one of the savedSearch file and I see that the path is referred many times as absolute.


I have tried to edit the file manually from command line with vim, but the old path doesn't change, as it seems that something is restoring the original saved search.

The question: is there a way to modify all the searches with a script, without having to delete and recreate them from scratch ?

1 Answer 1


I tested this on macOS Monterey and got it to work, it should work exactly the same on older macOS:

  1. Created a new smart search for freetext 'botanical' below my /Users/s/Downloads/BOOKS folder.

  2. Saved this smart search as ~/Desktop/smartBooks.savedSearch.

  3. I now want to replace /Users/s/Downloads/BOOKS with /Users/s/Downloads to search there instead.

  4. For this use search and replace with sed in your terminal:

cat smartBooks.savedSearch | sed 's_/Users/s/Downloads/BOOKS_/Users/s/Downloads_g' > smartBooks2.savedSearch 



(Yes this can be written much shorter and more elegant but leave it like this for ease of reading.)

  1. This results in the file ~/Desktop/smartBooks2.savedSearch that at least on my system behaves as expected.

If you have spaces or other special characters in your path, these need to be properly escaped.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .