skip to Main Content

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!

3

Answers


  1. 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.

    Login or Signup to reply.
  2. 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), e.g. if your bundle id is "com.foo.barApp" then you
    can run this from a terminal shell:

    defaults delete com.foo.barApp

    Login or Signup to reply.
  3. For anyone who comes here later for solution:

    1. install fd from homebrew: brew install fd
    2. search for your data folder: 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/…
    3. remove the folder: rm -rf Library/Containers/B155E847-3026-484D-8CC1-165E3CA1E9CD
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search