I had this problem a lot, too. Here are a few solutions:
general notes
The App Store says Xcode is 12.7 GB (13.3.1). I don't know why it says that, because:
The Xcode app is 32.5 GB, though it takes "only" 17.4 GB on disk.
I don't know what "on disk" means vs not, but it's right there if you "Get Info" on the Xcode app.
In practice, the App Store will say we don't have enough space unless we have ~46 GB free.
If you have a more precise number and/or know how to calculate it, let us know here!
(Add the Xcode app size of 32.5 + the App Store's 12.7 = 45.2?)
When upgrading Xcode, you can delete the old app version to free up space, then install the latest version.
Or safer: Copy the old Xcode app to another drive, just in case the new install fails.
Besides using the App Store, you can install/update Xcode manually. The problem with that is the App Store will then get out of sync, and thus think you don't have the latest version of Xcode, forever. This gets frustrating if you like having automatic App Store updates.
via the App Store
You can free space by moving the Xcode app to another drive (gave me 19 GB)
You can also move non-Xcode apps and big files to another drive, then move them back after Xcode installation.
Besides the Xcode app, there are related files elsewhere that could be deleted.
I found this article helpful (https://chris-mash.medium.com/saving-space-as-an-ios-developer-c09f5b6af395).
That article mentions the app "DevCleaner for Xcode":
(https://github.com/vashpan/xcode-dev-cleaner)
(https://apps.apple.com/us/app/devcleaner-for-xcode/id1388020431?mt=12)
manually via the Apple Developer download page
(https://developer.apple.com/download/applications/)
You could, for example:
Download the Xcode .xip (13.3.1 is 10 GB) and then extract it
If you don't have enough space to extract, then move the .xip to another drive and extract it there, then copy it back, overwriting the old Xcode app
Note: extracting the .xip is apparently much faster via the command line
(https://twitter.com/_saagarjha/status/1481353292164698112)
e.g., xip --expand <input-file>
"manually" with the third-party app, "Xcodes"
(https://github.com/RobotsAndPencils/XcodesApp#installation)
I tried this on my 2019 MacBook Air with its tiny 121 GB drive. (My only Mac right now.)
This actually worked really well. With the app's "Experiments" turned on, Xcode updated without me having to move or delete anything. (I had 37 GB free.)
remember
A manual solution may require less space, and could install faster. But then the App Store will always think you need to update Xcode. (Until you do update/install Xcode via the App Store.)
Having another drive is your friend and key to this! It doesn't have to be a big fancy external drive; I used a 120 GB flash drive/stick. Kinda slow, but it got the job done.
Post
Replies
Boosts
Views
Activity
(ver: Xcode 13.3.1)
Depends what you want to reset:
To reset Xcode -> Preferences…, and most other Xcode UI settings:
Delete your Xcode preferences:
In Terminal, enter defaults delete -app xcode
That resets ~/Library/Preferences/com.apple.dt.Xcode.plist
There's also these preferences files (but I didn't have to change them):
~/Library/Preferences/com.apple.preferences.extensions.XcodeSourceEditor.plist
/Library/Preferences/com.apple.dt.Xcode.plist
To reset Xcode -> Preferences… -> Accounts
Delete your Xcode cache: ~/Library/Caches/com.apple.dt.Xcode
My cache also had com.apple.dt.Xcode.sourcecontrol.Git, which I deleted, but didn't see any change.
To reset Xcode -> Preferences… -> Source Control -> Git
Delete your Git config: ~/.gitconfig
You can do this in the Finder, but first you have to toggle hidden files (press command-shift-.)
You can also delete ~/Library/MobileDevice and ~/Library/Developer, though I didn't have to for what I wanted.
The question is about making the UI look like it does on first launch. If you're trying to clean up Xcode because something doesn't seem to be running right, some other things to try are:
Quit Xcode and relaunch
Clean the project
Restart the Mac
Delete derived data
If you want to "factory reset" Xcode but later return to custom settings, first backup the relevant files so you can copy them back:
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Caches/com.apple.dt.Xcode
~/.gitconfig
I'm not sure the cache file will still work, so you may have to re-enter account info.
An answer here also suggests copying:
~/Library/Developer/Xcode/UserData/CodeSnippets
~/Library/Developer/Xcode/UserData/FontAndColorThemes
~/Library/Developer/Xcode/UserData/KeyBindings
~/Library/Developer/Xcode/Templates
~/Library/MobileDevice/Provisioning Profiles
Hope that helps!
Even though it’s Apple’s search engine for Apple’s documentation, it’s very unintuitive. We’re all used to Google searches:
If there are a million matches, it shows a million matches
If the search terms are mentioned anywhere on a webpage, it will probably match
Conversely, Apple Developer searches are like this:
If there are a million matches, it shows only a few (~20)
And it doesn’t tell you there are more matches, or give you any way to see them!
If the search terms are mentioned anywhere on a webpage, it still may not match
The Videos tab is inconsistent
Looks like it will show max 5 matches, again implying there are no more matches, and certainly no way to see them
(e.g., searching for xcode github gives 5 results, none of which are what I want) (https://developer.apple.com/search/?q=xcode%20github&type=Videos)
(but searching in Apple’s Developer app gives 3 results, two of which are promising) (“Source Control Workflows in Xcode” from 2018, and a similar one from 2017)
The Forums tab is broken and inconsistent
(e.g., searching for xcode github gives 0 results) (https://developer.apple.com/search/?q=xcode%20github&type=Forums)
(but searching directly in the forums gives 63,000+ results) (https://developer.apple.com/forums/search/?q=xcode+github)
The answer is to use Google to search Apple’s documentation:
E.g., go to Google (https://www.google.com/) and search for xcode github site:apple.com/documentation
(638 results!)
(including the 3rd result: “Configuring Your Xcode Project to Use Source Control”) (https://developer.apple.com/documentation/xcode/configuring-your-xcode-project-to-use-source-control) (just what I wanted!)
Example searching videos: xcode github site:apple.com/videos (141 results)
Example searching forums: xcode github site:apple.com/forums (5,820 results)
All those examples use Google’s site: option to restrict results to that site.
So, Apple’s documentation may be okay! Just remember to search via Google!
As noted in a previous answer by @OOPer, you probably want not to change your password, but instead generate a "personal access token." I don't know about previous versions, but in Xcode 13.3.1, the prompts indicate that reasonably well. One of the prompts links to GitHub's instructions on creating a personal access token (https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).
As of July 2021, personal access tokens can now expire. (https://github.blog/changelog/2021-07-26-expiration-options-for-personal-access-tokens/) You can still set your token not to expire, but they "strongly recommend" against that. You can set the expiration up to 1 year (via "custom" date).
When your token expires, GitHub will email you with a link to GitHub's site to regenerate the token. You can also do that from GitHub's site by going to the "Personal Access Token" section -> click on the token name -> "Regenerate token."