vashpan / xcode-dev-cleaner

If you want to reclaim tens of gigabytes of your storage used for various Xcode caches - this tool is for you!
GNU General Public License v3.0
1.23k stars 58 forks source link

FEATURE REQUEST: Add support for Xcode Platform SDK runtime downloads #38

Open chockenberry opened 2 years ago

chockenberry commented 2 years ago

Beginning with Xcode 14, separate SDK runtimes are downloadable for tvOS and watchOS. The disk images for these SDK runtimes are stored in /Library/Developer/CoreSimulator/Images and are quite large (typically 3-4 GB in size).

These images are mounted at /Library/Developer/CoreSimulator/Volumes. You can see them in Disk Utility under "Disk Images".

The downloads can be managed in Xcode's preferences in the Platforms panel. The same information can be viewed on the command line with:

$ xcrun simctl runtime list

(Add -v to get a more verbose listing.)

The platform downloads can be deleted with:

$ xcrun simctl runtime delete <id>

Since DevCleaner's job is to get rid huge amounts of Xcode stuff you don't need anymore, it seems like this would be a good thing to support in the app.

chockenberry commented 2 years ago

This isn't a duplicate of #21 since these are not the "built-in" simulators. It's interesting to note that the same xcrun commands can be used both downloaded and built-in simulators (and may be easier to use in a sandbox).

vashpan commented 2 years ago

I've indeed looked into this, and unfortunately there are two problems:

The only real solution would be to have a non-AppStore and non-sandboxed version of DevCleaner, which I'm thinking more and more about. MAS is giving a lot, but also it's limiting the app like that.

chockenberry commented 2 years ago

Believe me, I understand the challenges of running scripts on behalf of the user:

https://www.objc.io/issues/14-mac/sandbox-scripting/

I wrote that article many years ago and have since had issues getting it through App Review. I don't think the second option is viable as a long-term solution. I also don't want any app to run with root access, so the first option is a non-starter.

So let's explore the Mac App Store:

Versus distribution on a website:

The biggest differentiator for me is collecting the money. On the Mac App Store, it took me 30 seconds to give you $10. If I had to do that on a website where I entered a credit card, that would be a barrier. If you built a Stripe/ApplePay integration into the app, that would be nearly as good as the Mac App Store.

I would also note that I always use the website version of the tools I need for development. I know it will be a better product in subtle ways. If you go the way of Panic, Bare Bones, GitHub, and Leitmotif, no developer will bat an eye.

Seems to me that DevCleaner needs to leave the Mac App Store.

chockenberry commented 1 year ago

I just discovered that xcrun simctl is just a frontend for a binary located in /Applications/Xcode.app/Contents/Developer/usr/bin/simctl. If you make user select the Xcode.app folder and save it as a security scoped bookmark, you may be able to launch that script on behalf of the user.

Still, much easier to make the app work outside a sandbox.

vashpan commented 1 year ago

Yeah, but even if I could run it from the app (I'm not sure if sandboxed apps can ran other programs at all? Even if they have access to binary), it'll still be sandboxed within DevCleaner sandbox and not running on the real filesystem.

So yeah, working outside the sandbox is probably the way to evolve the app, and I'm mentally prepared for that, and I'll start working on it when I'll have some time.