How I cleaned my MacBookPro 2015 and released 50Gb of disk space

Oleksandr - Oct 24 - - Dev Community

Introduction

One perfect day I noticed that my system disk is out of space although I did not expect it to happen so fast (7 years is not a long time, no-no).
Here is how you can check your disk as well:
Image description

Image description

But anyway, after googling and applying some tips and tricks I decided to share my way of mac disk cleanup.

Hadi gidelim (Let's go - turkish)

Plz apply at your own risk. It may harm your laptop, be sure you are not deleting crucial system or personal files.

1. Outdated node_modules

If you do not delete old projects which you git-cloned, npm-installed and ran on your computer - you may be surprised how much space to may take.
To find out open Finder and run search with such statement:

kind:Folders node_modules
Enter fullscreen mode Exit fullscreen mode

After search finish, select all folders, right click with mouse and chose "Get [summary] info" to calculate total space:

Image description

And 4Gb - is not that small.

Image description

After that you can check each of them by right-clicking and selecting "Show in enclosing folder"

Image description

and delete if it is a project you don't plan to run anymore.

2. npm cache cleanup

If you do not clean npm cache - it may contain may outdated packages.
So just run

npm cache clean -f
Enter fullscreen mode Exit fullscreen mode

Prior to this you can check how much space it takes. Open a terminal:

cd ~/.npm
du -h

Enter fullscreen mode Exit fullscreen mode

Image description
(And this is a value after cleanup was done recently).
So cleaning npm cache from time to time is not a bad idea.

3. Old Docker related files

If you use Docker some old images may stay on a disk so better to get rid of them:

docker system prune -a
Enter fullscreen mode Exit fullscreen mode

4. Docker.raw file

Docker for Mac stores containers and images in a single large file named Docker.raw.
To reduce its side after prun open Docker Desctop preferences and then under 'Resources'->'Advanced' setup Disk image size (my default was 64Gb!)

Image description

5. Terraform cache files.

If you use Terraform to rollout infrastructure (or at least passed some Terraform video course) do not forget to remove .terraform cache folder in each project. It is really big

6. Microsoft OneNote cache

If you use Microsoft OneNote on Mac - it keeps local backup (although it is stored already in a cloud).
We can a) turn backup off and b) remove it.

a) How to turn it off?
Open System Preferences

Image description

Choose TimeMachine on the panel. Uncheck the checkbox "Backup Automatically"
Image description

Well, actually you just turned off the whole Mac backup, so think twice.

b) Now let's remove the local OneNote backup
Finder -> Go -> Go to folder and enter: ~/Library/Containers
Image description

And then navigate to
/Users/oposhtaruk/Library/Containers/com.microsoft.onenote.mac/Data/Library/Application Support/Microsoft User Data/OneNote/15.0
and remove folder Backup.

7. Remove old Google Cache.

There are some old Google Cache files in a folder
/Users/oposhtaruk/Library/Application Support/Google/Chrome/Default.

Go there in a terminal

cd "/Users/oposhtaruk/Library/Application Support/Google/Chrome/Default"

Enter fullscreen mode Exit fullscreen mode

And run du command to output the biggest folders there:

sudo du -h -d2 | grep G
Enter fullscreen mode Exit fullscreen mode

Image description

Remove any folder that have Cache in their name (do this for your own risk, I did with no consequences)

8. Applications cache cleanup.

Check cache folders of old uninstalled programs (or even existing ones but with extra-large outdated cache) with such terminal commands:

cd ~/Library/Caches
sudo du -h -d2 | grep G
Enter fullscreen mode Exit fullscreen mode

Image description

Delete the biggest folders or folders of applications that you uninstalled.

9 Edge Updater Files

Btw I don't why it makes so much space.
But here we are:

Image description

cd ~/Library/Application Support/Microsoft/EdgeUpdater/apps/
sudo du -h -d2 | grep G
Enter fullscreen mode Exit fullscreen mode

I just deleted all subfolders in ./EdgeUpdater/apps/msedge-canary

And here we are! Some GB's of space are freed and we can continue wasting using it again.

This article is a part of my own learning process. If you found some wrong or partially wrong statement — feel free to correct me in comments.

Let’s keep in touch on Twitter!

Cheers!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player