MacOS – What casues macOS sidebar to drop “favorites” (shortcuts to linked files/directories), other than macOS updates? How to prevent

applescriptfindermacosshortcutsymlink

Every month or so my Macs drops all the favorites I have in the Finder windows (which also appear in Save/Open system dialogue windows). I takes time to redo them, and it is frustrating.

I know that there are questions here and on other forums about this happening after macOS updates, but I find it happens without warning — even without doing a User logout and login it can happen, especially links to pCloud files (which uses a virtual drive system extensions.) Links to directories on external and mounted volumes disappear as well!

I've tried using symlinks in Terminal and they suffer the same fate. The only other thing I can think of is an Applescript routine to save the aliases to a list in a file and another routine to reinstall the links as "Favorites".

This has occurred in many past versions of macOS for as long as I can remember. My Mac is currently on Mojave (internal boot partition) and Catalina (external drive boot partition.)

Does anybody have any viable solutions and/or remedies I should consider?

Best Answer

I do not know what's causing you to loose the customizations you've made to items under Favorites in the Sidebar of Finder or how to prevent it, however here is a backup and restore solution for when it does happen. This should certainly be easier then manually having to restore all the lost items under Favorites in the Sidebar of Finder.

At one time, items under Favorites in the Sidebar of Finder were stored in the ~/Library/Preferences/com.apple.finder.plist file and then the ~/Library/Preferences/com.apple.sidebarlists.plist file.

However, they are now stored in:

~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteItems.sfl2

Which version of macOS it was changed to the later I'm not sure, however certainly in macOS Mojave and later it is in com.apple.LSSharedFileList.FavoriteItems.sfl2 file.

In at least macOS Mojave and later, to backup this file after the items you always want to be under Favorites in the Sidebar of Finder, to then later restore as needed, first do the following in Terminal:

cd ~/Library/Application\ Support/com.apple.sharedfilelist/
cp com.apple.LSSharedFileList.FavoriteItems.sfl2 com.apple.LSSharedFileList.FavoriteItems.sfl2.Custom

With that done, if and when the items under Favorites in the Sidebar of Finder get reset and your customizations are lost, then do the following to restore them:

In Terminal:

cd ~/Library/Application\ Support/com.apple.sharedfilelist/
cp com.apple.LSSharedFileList.FavoriteItems.sfl2.Custom com.apple.LSSharedFileList.FavoriteItems.sfl2

Then immediately press ⇧⌘Q and then Enter to Log Out.

Once the log out is complete, you can log in and the Favorites in the Sidebar of Finder will be back to your customized settings.


Note: You may have to give Full Disk Access to Terminal in System Preferences > Security & Privacy > Privacy in order to run the aforementioned commands.