There are three places where macOS is most likely to generate spam files: Xcode, iTunes and VMWare virtual machines.
1. Garbage generated by Xcode
On the command line, cd to the ~/Library directory, enter the command:
sudo du -d 1 -h
Seeing that Developer occupies 59 G, cd to Developer directory continues to locate large files with the du command above. It is found that three directories occupy the most:
(1) Users/exchen/Library/Developer/Xcode/Derived Data, temporary files generated by Xcode compilation can be completely emptied. This usually takes up a few G.
(2) Users/exchen/Library/Developer/Xcode/iOS Device Support. Xcode is used to debug and generate system symbol files. According to the situation, some commonly used debugging machines can be deleted, which usually occupies dozens of G. The author's computer occupies more than 40 G, the specific information is as follows:
$ sudo du -d 1 -h 1.9G ./11.0.1 (15A402) 2.1G ./9.0 (13A344) 1.9G ./11.0.2 (15A421) 2.0G ./11.2 (15C114) 2.0G ./11.3.1 (15E302) 2.9G ./10.2.1 (14D27) 1.8G ./8.4.1 (12H321) 1.6G ./8.1 (12B411) 2.9G ./10.2 (14C92) 797M ./8.2 (12D508) 1.9G ./11.0 (15A372) 2.9G ./10.1.1 (14B100) 996M ./9.0.1 (13A404) 2.9G ./10.3.3 (14G60) 2.9G ./10.3.2 (14F89) 1.7G ./8.3 (12F70) 2.0G ./11.1.1 (15B150) 2.9G ./10.3.1 (14E304) 2.2G ./9.3.5 (13G36) 2.0G ./11.1.2 (15B202) 1.6G ./8.0.2 (12A405) 44G .
Delete unused system version directories:
$ rm -rf "9.3.5 (13G36)" $ rm -rf "8.0.2 (12A405)" $ rm -rf "8.1 (12B411)" $ rm -rf "8.2 (12D508)" $ rm -rf "8.3 (12F70)" $ rm -rf "9.0 (13A344)" $ rm -rf "11.0.1 (15A402)" $ rm -rf "11.0.2 (15A421)" $ rm -rf "11.1.1 (15B150)" $ rm -rf "10.2 (14C92)" $ rm -rf "10.2.1 (14D27)" $ rm -rf "11.1.1 (15B150)" $ rm -rf "11.1.2 (15B202)"
(3) Users/exchen/Library/Developer/Xcode/Archives, Xcode packages are saved here, generally there will be several G, the author's computer occupies 5.3 G, the specific information is as follows:
$ sudo du -d 1 -h 15M ./2018-07-14 2.6G ./2018-07-25 1.8M ./2018-07-12 19M ./2018-07-15 169M ./2018-06-15 490M ./2018-06-30 7.8M ./2018-07-06 24M ./2018-07-09 2.2M ./2018-07-10 41M ./2018-07-17 1.7G ./2018-07-26 19M ./2018-07-18 18M ./2018-07-16 77M ./2018-06-20 1.9M ./2018-06-28 53M ./2018-06-19 73M ./2018-07-04 13M ./2018-07-03
Some old versions of useless packages can be deleted as needed.
2. iTunes backup directory
(1) After the mobile phone is inserted into the computer, the default iTunes will automatically backup, delete directories that do not need backup according to the situation, open / Users / exchen / Library / Application Support / Mobile Sync / Backup, and you will see the corresponding backup directory, a directory is the backup data of a mobile phone. The information is as follows:
$ du -h 6.9M ./68595a50880ac28f66a337e338b6b433e45232d8/Snapshot 835M ./68595a50880ac28f66a337e338b6b433e45232d8 835M . $ rm -rf 68595a50880ac28f66a337e338b6b433e45232d8
(2) An application installed with iTunes will save IPA packages in the directory: / Users/exchen/Music/iTunes/iTunes Media, which can be deleted if it is not necessary to save. The information is as follows:
$ ls -al total 5327944 drwxr-xr-x 23 exchen staff 736 5 5 22:38 . drwxr-xr-x 8 exchen staff 256 5 15 23:42 .. -rw-r--r--@ 1 exchen staff 6148 4 2 15:09 .DS_Store -rw-r--r-- 1 exchen staff 95598501 9 2 2017 Chrome 47.2526.107.ipa -rw-r--r--@ 1 exchen staff 28631235 3 29 22:34 Lucky Test 1.3.ipa -rw-r--r-- 1 exchen staff 17631079 5 3 14:11 XX.ipa -rw-r--r-- 1 exchen staff 164171 7 19 2017 getAuth_81.ipa -rw-r--r--@ 1 exchen staff 3274620 3 30 11:52 iDevice 1.3.1.ipa -rw-r--r--@ 1 exchen staff 3637154 3 30 11:52 iDeviceLite 1.3.1.ipa -rw-r--r-- 1 exchen staff 10703740 5 5 21:57 webview.ipa -rw-r--r--@ 1 exchen staff 184542678 4 17 18:43 WeChat 6.6.6.ipa -rw-r--r-- 1 exchen staff 195773251 9 2 2017 Alipay 10.0.20.ipa -rw-r--r-- 1 exchen staff 39572540 3 19 17:44 Let's love it..ipa -rw-r--r--@ 1 exchen staff 841399502 4 4 15:56 Dream Journey to the West 1.168.0.ipa -rw-r--r-- 1 exchen staff 45382867 9 2 2017 Battery Doctor 1.4.ipa -rw-r--r-- 1 exchen staff 207238424 9 2 2017 Baidu Map 10.1.0.ipa -rw-r--r-- 1 exchen staff 312228484 9 2 2017 Dali Dali 5.12.1.ipa -rw-r--r-- 1 exchen staff 9748224 9 2 2017 Mobile monitor 1.0.3.ipa -rw-r--r-- 1 exchen staff 644014622 9 2 2017 Brother Tu Long Chuan 2.2.ipa
3. Clean up VMware Fusion Virtual Machine
Virtual machines have been used for a long time, and need to be cleaned up and free up space. The method is to select the target virtual machine, select "Settings" - > "General" from the right-click menu, and click the "Clean up Virtual Machine" button. Generally, it can release at least a few to a dozen gigabytes of space, as shown in the following figure. You can rest assured that after cleaning up, the use of virtual machines will not be affected.
Original address: https://www.exchen.net/macos-manual-clean-trash.html