Added support to immediately delete Xcode and its XIPs#211
Merged
MattKiazyk merged 3 commits intoXcodesOrg:mainfrom Sep 18, 2022
Merged
Added support to immediately delete Xcode and its XIPs#211MattKiazyk merged 3 commits intoXcodesOrg:mainfrom
MattKiazyk merged 3 commits intoXcodesOrg:mainfrom
Conversation
After Pull Request XcodesOrg#60, `xcodes` always moves Xcode's .xip to the Trash after installation. This is problematic for scripts, because on modern macOS versions, [Full Disk Access is required to programatically delete the Trash](https://apple.stackexchange.com/questions/376916/cannot-ls-trash-in-the-terminal-in-catalina-operation-not-permitted). To solve this without reducing security, added a new `--delete-xip` flag that automatically deletes the .xip after a successful installation. - This is done this way to preserve the current behaviour (moving the .xip to the Trash) by default, [as it was originally intended](XcodesOrg#56 (comment)). This closes XcodesOrg#185.
This is equivalent to the `--delete-xip` flag that was added to `xcodes install` on the previous commit.
This two flags do essentially the same thing (skip the Trash and irrevocably delete Xcode or its .xip) so it makes sense to use the same name for both. - Although the Trash isn't really "emptied" (the files never get to the Trash in the first place), this is the most intuitively way I've found to refer to this at a high level. - Alternatives considered: - `--skip-trash`. This explains better the current implementation, but I think it's more ambiguous: if the user doesn't know that by default files are moved to the Trash, "skip Trash" could be understood as "skip deleting files from the Trash"... - `--delete-immediately` (the way Finder refers to deleting a single file from the Trash). This is longer to type, and "immediately" could imply that, without this flag, files will be automatically deleted in the future somehow.
MattKiazyk
approved these changes
Sep 18, 2022
Contributor
|
Thanks @juanjonol |
juanjonol
added a commit
to juanjonol/Xcode-Update
that referenced
this pull request
Sep 18, 2022
I use `xcode-update` with a different user that the one I'm logged in on Finder, so emptying the Trash after each installation was a PITA. - See `xcodes` Pull Request #211, “Added support to immediately delete Xcode and its XIPs”: XcodesOrg/xcodes#211
juanjonol
added a commit
to juanjonol/Xcode-Update
that referenced
this pull request
Sep 18, 2022
Functionality-wise this is virtually the same, but: - `xcodes` uses Apple's [`removeItem`](https://developer.apple.com/documentation/foundation/filemanager/1413590-removeitem) API, which _theoretically_ could had additional features over a raw `rm` (leverage APFS features, maybe remove Xcode from macOS Launch Services...). - This slightly improves `xcode-update` output: for example, instead of showing `- <PATH_TO_XCODE>/Xcode-14.0.0-Beta.6.app will be deleted.` now it will show `- Xcode 14.0 Beta 6 (14A5294g) will be deleted.` I can use `xcodes uninstall` for this now only because the `--empty-trash` parameter was added. - See `xcodes` Pull Request #211, “Added support to immediately delete Xcode and its XIPs”: XcodesOrg/xcodes#211 - I explicitly want to completely delete Xcode (not to move it to the Trash) for the same reasons I did "Added support to automatically delete Xcode's .xip after installation" (7382b7e) and also because deleting Xcode using Finder is a extremely slow operation... With this change, we no longer can verify `xcode-update` has permissions to delete the Xcode version selected... I think this is an acceptable compromise, because `xcodes uninstall` should check for permissions more thoughtfully than I did, but if it doesn't maybe I'll have to revert this commit... - See commit “Added check to ensure the current user has permissions to delete Xcode versions” (9a0bb30)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a new
--empty-trashflag toxcodes installandxcodes uninstall, to completely delete Xcode's .xip or the app itself instead of keeping it on the user's Trash.This closes #185.