In a earlier post of mine, I said that I solved the problem with the phantom tabs by renamining the safari folder. This was true, but recognized that the iCloud tab groups stopped working. I didn’t want to fully log of from iCloud on my Mac and tried several things. I created a temp user and to test the sync and it was working. After that I searched a way to reset safari. The official way by cleaning the history and cache was useless. Apple said that Safari can only be reinstalled with the full MacOS. This was no option for me. But finally I was able to reset all settings with one of the following commands and steps (some of them I had to manually)
mv ~/Library/Safari ~/Desktop/Safari-`date +%Y%m%d%H%M%S`;
rm -Rf ~/Library/Cache/*;
rm -Rf ~/Library/Caches/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery;
rm -Rf ~/Library/Caches/Metadata/Safari;
rm -Rf ~/Library/Caches/com.apple.Safari;
rm -Rf ~/Library/Caches/com.apple.WebKit.PluginProcess;
rm -Rf ~/Library/Cookies/*;
rm -Rf ~/Library/Cookies/Cookies.binarycookies;
rm -Rf ~/Library/Preferences/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery;
rm -Rf ~/Library/Preferences/com.apple.Safari.LSSharedFileList.plist;
rm -Rf ~/Library/Preferences/com.apple.Safari.RSS.plist;
rm -Rf ~/Library/Preferences/com.apple.Safari.plist;
rm -Rf ~/Library/Preferences/com.apple.WebFoundation.plist;
rm -Rf ~/Library/Preferences/com.apple.WebKit.PluginHost.plist;
rm -Rf ~/Library/Preferences/com.apple.WebKit.PluginProcess.plist;
rm -Rf ~/Library/PubSub/Database;
rm -Rf ~/Library/Safari/*;
rm -Rf ~/Library/Safari/Bookmarks.plist;
rm -Rf ~/Library/Saved\ Application\ State/com.apple.Safari.savedState;
- Quit Safari
- Turn off iCloud sync for Safari from Preferences -> Apple ID -> iCloud -> Safari
- Make a backup folder for the files : mkdir ~/Documents/iCloudTabsBackup
- Go to your Safari folder, it should contain files such as CloudTabs.db : cd ~/Library/Safari
- Move all the related files into the backup folder mv CloudTabs.* ~/Documents/iCloudTabsBackup/
- Turn on iCloud sync from Preferences -> Apple ID -> iCloud -> Safari
- Open Safari
mv ~/Library/Safari ~/Desktop/Safari-`date +%Y%m%d%H%M%S`; \
rm -Rf ~/Library/Caches/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery; \
rm -Rf ~/Library/Caches/Metadata/Safari; \
rm -Rf ~/Library/Caches/com.apple.Safari
rm -Rf ~/Library/Caches/com.apple.WebKit.PluginProcess
rm -Rf ~/Library/Cookies/Cookies.binarycookies
rm -Rf ~/Library/Preferences/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery
rm -Rf ~/Library/Preferences/com.apple.Safari.LSSharedFileList.plist
rm -Rf ~/Library/Preferences/com.apple.Safari.RSS.plist
rm -Rf ~/Library/Preferences/com.apple.Safari.plist
rm -Rf ~/Library/Preferences/com.apple.WebFoundation.plist
rm -Rf ~/Library/Preferences/com.apple.WebKit.PluginHost.plist
rm -Rf ~/Library/Preferences/com.apple.WebKit.PluginProcess.plist
rm -Rf ~/Library/PubSub/Database; \
rm -Rf ~/Library/Saved\ Application\ State/com.apple.Safari.savedState
rm ~/Library/Preferences/com.apple.Safari*
rm -r ~/Library/Containers/com.apple.Safari
rm -r ~/Library/Caches/com.apple.Safari