My computer has been getting low on hard drive space and I thought it might be a good time to clean up after XCode. A few simple tasks gave me back over 60 gigabytes of wasted XCode files.<\/p>\n
The simplest task is to remove the folders inside the DerivedData folder that XCode uses to profile projects. <\/a><\/p>\n Delete the folders inside the DerivedData folder. This alone gave me back over 30 GBs. In the below example there are only two folders inside DerivedData, so in this case delete those two folders.<\/p>\n <\/a><\/p>\n XCode makes build folders to store files to speed up compilation times. If you are no longer working with the project, you won’t need faster compile times, so you should get that HD space back. The .<\/strong> tells the command to traverse the hierarchy starting with the current folder. -type d<\/strong> limits the search to directories and the -ok<\/strong> asks before executing the code to the right of it. Make sure to navigate to the folder you wish to start with using cd. For example, executing Keep in mind that if you choose to delete the folder, it will also remove all of its contents. So if you have another folder that is named build<\/em>, make sure it is one that you want to delete!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":" My computer has been getting low on hard drive space and I thought it might be a good time to clean up after XCode. A few simple tasks gave me back over 60 gigabytes of wasted XCode files. Derived Data The simplest task is to remove the folders inside the DerivedData folder that XCode uses […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[61],"tags":[167,168,166],"_links":{"self":[{"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/posts\/662"}],"collection":[{"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/comments?post=662"}],"version-history":[{"count":0,"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/posts\/662\/revisions"}],"wp:attachment":[{"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/media?parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/categories?post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nickhardeman.com\/wp-json\/wp\/v2\/tags?post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\nThe DerivedData folder might be located at ~\/Library\/Developer\/XCode\/DerivedData<\/em>
\nIf the folder is non-existent or it is empty and you have opened at least one XCode project, the DerivedData folder might be set to a different location. Open XCode and click XCode > Preferences<\/em>. Navigate to the Locations<\/em> tab on the top right and locate the Derived Data<\/em> section. Click on the small arrow to reveal the folder in the finder.<\/p>\nRemove XCode Build Folders<\/h3>\n
\nWe can use the find command to locate all directories with the name build<\/em> and delete them, but only before asking. This post breaks down the command<\/a>. The command is
\nfind . -type d -name 'build' -ok rm -rf {} \\;<\/code><\/p>\n
\ncd ~\/Documents\/myprojectfolder\/<\/code>
\nand then executing
\nfind . -type d -name 'build' -ok rm -rf {} \\;<\/code>
\nwould find all directories with the name build<\/em> in the myprojectfolder<\/em> and its children. For every directory it finds, it will ask if it should delete it. Type y<\/code> for yes and
n<\/code> for no. <\/p>\n