-
Notifications
You must be signed in to change notification settings - Fork 0
/
clear_some_space_on_macos.sh
94 lines (63 loc) · 2.13 KB
/
clear_some_space_on_macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# The basics
#
# Measure the size of a folder:
#
# du -sh <folder_name>
#
# See the sizes of all the folders in the current directory (can take some time):
#
# du -sk * | sort -n -k 1
# For Linux, see: stacer (logs and app caches) and bleachbit (cookies and journalctl)
# For Linux: rm -rf ~/.cache
# NPM and Yarn
# Caches
# If you use npm or yarn, and you don't mind it being slow the next time you run it
# ~/.npm/_cacache/
npm cache clean
# "$(yarn cache dir)"
yarn cache clean
# To clear old node_modules folders
#cd
# Largest first (quick)
#npx npkill -s size
# Alphabetically (thorough)
#npx npkill
# NVM (node version manager)
# The cache is not usually very big
# ~/.nvm/.cache/
nvm cache clear
# You can list all installed versions
#nvm ls
# And remove the ones you aren't using
#nvm rm <node_version>
# WebStorm
# If you have multiple folders matching ~/Library/Caches/WebStorm2019.* you can remove all but the last one.
# If you stop WebStorm, you can remove all of them.
# Xcode
# This should clear out ~/Library/Developer/CoreSimulator/Devices
# https://stackoverflow.com/questions/33419301/macos-xcode-coresimulator-folder-very-big-is-it-ok-to-delete-content
xcrun simctl delete unavailable
# These are only needed for symbolicate of devices you have plugged in
# https://stackoverflow.com/questions/29930198/can-i-delete-data-from-ios-devicesupport
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# Archives of apps you have built
#rm -rf ~/Library/Developer/Xcode/Archives/*
# Cordova
rm -rf ~/.cordova/lib/tmp
rm -rf ~/.cordova/lib/npm_cache
rm -rf ~/.gradle
# Android development
## Virtual devices for the emulator
rm -rf ~/.android/avd/*
# Things installed by pip (python's package manager)
#rm -rf ~/.local/lib/python*.*/
# Docker
# Clear stopped containers and caches
docker system prune -f
# Remove all images and volumes except those used by running containers
#docker system prune --all
#
# Also check /var/lib/docker/volumes
# Some images store data here
# E.g. the mongo image with no arguments kept creating fresh new databases here, but never reusing them!