When using the iOS Simulator, I can simply delete the app and re-run the app to start fresh. How is this done for mac os apps? I can't find it out. There is a folder for the project inside "DerivedData", but deleting this also messes with the entire project and I have to re-fetch all dependencies and stuff.
Thanks!
Had the same question, found the answer in another question on Stack Overflow: Nicolas Miari and superfell's answer did the trick for me and my Mac Catalyst app:
You can use the defaults command line tool to remove all the settings, you just need the bundle id of your app (which you can find in your Info.plist file), eg if your bundle id is "com.foo.barApp" then you can run this from a terminal shell:
defaults delete com.foo.barApp
For anyone who comes here later for solution:
brew install fd
fd com.thisIsYour.bundleId
You should see something likes this: Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/... Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/... Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD/Data/Library/...rm -rf Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD
If the app is storing something at say ~/Library/Caches/yourapp
or ~/Library/Application Support/yourapp
, it's trivial to set up an Automator Service, or bash alias to clean them up.
~/Library/Developer/Xcode/DerivedData
is meant for the Xcode project and the things Xcode creates, not the things that your app creates such as user preferences.
Alternatively, you can create a listener for a flag in the app itself like --run-fresh
that can be set in scheme settings as launch argument. This flag will (if you code it) stop the app from looking into user data folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.