OSX HD Cleanup for Developers

So you are an iOS Developer and Mac user, ain’t it? I’ll show you some tips I use to reclaim my HD space [=

As a Mac user you shold have TimeMachine enabled in order to keep your things backed-up .

You should know that Time Machine has by default the Automatic Backup enabled that takes some snapshots also on local storage waiting for a full backup on your external HD.

It’s show time, so open up a Terminal window!

To see these snapshots you do:

sudo tmutil listlocalsnapshots /
sudo tmutil listlocalsnapshots /
com.apple.TimeMachine.2018-10-02-150623
com.apple.TimeMachine.2018-10-03-120519
com.apple.TimeMachine.2018-10-03-130357
com.apple.TimeMachine.2018-10-03-140849
com.apple.TimeMachine.2018-10-03-150352

In order to delete a local snapshot you have to type:

sudo tmutil deletelocalsnapshots 2018-10-02-150623
sudo tmutil deletelocalsnapshots 2018-10-02-150623
Deleted local snapshot '2018-10-02-150623'

Were you used to disable localsnapshots, do you say?

With OSX High Sierra+ you cannot. (Without disabling automatic backups). Correct me if I’m wrong.

Anyway, if you need to reclaim some of your HD space you could delete all local snapshots in one shot:

sudo tmutil listlocalsnapshots / | sed 's/com.apple.TimeMachine.//g' | xargs -I % sudo tmutil deletelocalsnapshots %
$ sudo tmutil listlocalsnapshots / | sed 's/com.apple.TimeMachine.//g' | xargs -I % sudo tmutil deletelocalsnapshots %
Deleted local snapshot '2018-10-03-130357'
Deleted local snapshot '2018-10-03-140849'
Deleted local snapshot '2018-10-03-150352'
Deleted local snapshot '2018-10-03-160946'

Another trick you could use is to delete all the old Device Debug Support symbols that Xcode download every time you connect a new physial device to your Mac with a new iOS Version. So you will have, for example, debug symbols for 10.3, 10.3.1, 10.3.2, …, 11.0.0, 11.1.0, …, 11.4.1, … and so on.

This symbols are stored in the following directory:

~/Library/Developer/Xcode/iOS DeviceSupport/

Let’s check it out by entering the above directory and typing:

find . -type f -size +1G | xargs -I % du -h %

You sould see some big files (more than 1 giga):

find . -type f -size +1G | xargs -I % du -h %

1.0G ./11.3 (15E216)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.4 (15F79)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.3.1 (15E302)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.2.5 (15D60)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.4.1 (15G77)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.2.6 (15D100)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64
If you need them no more… delete’em all! (or only the ones you need no more [=)
Hope this tips could be of any help to you. Let me know your tips if you do have different ones!
Bye!
OSX HD Cleanup for Developers