Warning: Be careful about these commands, before applying these, remember, you are deleting files and data. Be aware of what are you deleting. You could lose data forever.
I wrote this post because when you are developing you depend on tools, dependencies, docker images, etc. And in some moment your disk is full.
Using the next commands you can recover some disk space used.
Recover some disk space used by:
Brew
brew cleanup
Docker
If you are using docker, check docker's directory
du --max-depth=1 -h ~/Library/Containers/com.docker.docker/Data
If it is using too much space you could apply a prune. Remember this command will delete docker's images and volumes.
If you have important data, back up it before.
docker system prune -a --volumes
Cache directories
Check your Cache directory and delete some of the directories that use more disk space (in my case those were Spotify, pip, and Cypress).
du --max-depth=1 -h ~/Library/Caches/ | sort -hk1
I hope that these commands could be useful for recovering some space on your disk.
Do you have other tips to recover disk space on OSX? please add those in the commentaries.
Top comments (0)