mikes-macos-developer-disk-cleanup 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +2 -1
- package/CHANGELOG.md +21 -0
- package/mikes-macos-disk-cleanup.sh +52 -2
- package/modules/cargo-cache.sh +40 -0
- package/modules/docker-files.sh +13 -3
- package/modules/dotcache.sh +8 -0
- package/modules/expo.sh +14 -0
- package/modules/golang-cache.sh +23 -0
- package/modules/homebrew-caches.sh +1 -2
- package/modules/library-caches-lsof-output.awk +138 -0
- package/modules/library-caches.sh +28 -3
- package/modules/logs.sh +8 -0
- package/modules/mediaanalysisd.sh +8 -0
- package/modules/messagespreviews.sh +9 -0
- package/modules/mobilesmstmp.sh +8 -0
- package/modules/msteams.sh +13 -0
- package/modules/ruby-gems.sh +4 -2
- package/modules/vscodeextensions.sh +9 -0
- package/modules/xcode-artifacts.sh +21 -16
- package/modules/yarn-cache.sh +9 -1
- package/package.json +1 -1
package/.vscode/settings.json
CHANGED
@@ -9,14 +9,15 @@
|
|
9
9
|
"gradle-shared",
|
10
10
|
"hints",
|
11
11
|
"homebrew-caches",
|
12
|
+
"infra",
|
12
13
|
"library-caches",
|
13
14
|
"meteor-builds-and-packages",
|
14
15
|
"node-modules",
|
15
16
|
"npm-cache",
|
16
17
|
"ruby-gems",
|
18
|
+
"*",
|
17
19
|
"trash",
|
18
20
|
"xcode-artifacts",
|
19
21
|
"yarn-cache",
|
20
|
-
"infra"
|
21
22
|
]
|
22
23
|
}
|
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## 1.0.11 - 2025-05-14
|
6
|
+
|
7
|
+
[v1.0.10...1.0.11](../../compare/v1.0.10...1.0.11)
|
8
|
+
|
9
|
+
### :rocket: New features
|
10
|
+
|
11
|
+
- :sparkles: add more folders to clear [<sup>(f97bab9)</sup>][f97bab9]
|
12
|
+
|
13
|
+
### :bug: Bug fixes
|
14
|
+
|
15
|
+
- *(*)* :arrow_up: npm audit fix [<sup>(fe33211)</sup>][fe33211]
|
16
|
+
|
17
|
+
### :gear: Miscellaneous Tasks
|
18
|
+
|
19
|
+
- :technologist: vscode config: conventional commit scopes [<sup>(58af793)</sup>][58af793]
|
20
|
+
|
21
|
+
<!-- LINKS -->
|
22
|
+
[f97bab9]:../../commit/f97bab9f8bd42adcdabba32a6c34139874b38b64
|
23
|
+
[fe33211]:../../commit/fe33211298811f123e7a5a7189786f668ee9572b
|
24
|
+
[58af793]:../../commit/58af793e6a88cf7c756db682548d800eff3ffbae
|
25
|
+
|
5
26
|
## 1.0.10 - 2025-03-04
|
6
27
|
|
7
28
|
[v1.0.9...1.0.10](../../compare/v1.0.9...1.0.10)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/bash
|
2
2
|
# ####### Mikes Ultimate Mac OS Developer Disk Cleanup ######
|
3
3
|
# @author Mike Cunneen (https://github.com/cunneen)
|
4
4
|
# @license MIT
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# This script will clean up your Mac's disk space. Aggressively.
|
9
9
|
# Currently it searches for (and cleans) the following items:
|
10
10
|
# - MacOS Trash
|
11
|
-
# - MacOS (User) Library Caches
|
11
|
+
# - MacOS (User) Library Caches - ALL OF THEM!
|
12
12
|
# - meteor package cache (shared between projects)
|
13
13
|
# - meteor projects in your development base directory
|
14
14
|
# - node_modules folders in your development base directory
|
@@ -27,6 +27,16 @@
|
|
27
27
|
# - Android AVDs
|
28
28
|
# - Homebrew caches
|
29
29
|
# - CocoaPods
|
30
|
+
# - GoLang cache
|
31
|
+
# - Cargo Caches
|
32
|
+
# - MediaAnalysisD cache
|
33
|
+
# - MobileSMS temp files
|
34
|
+
# - MS Teams temp files
|
35
|
+
# - Messages Previews cache
|
36
|
+
# - Log files
|
37
|
+
# - VSCode Extensions
|
38
|
+
# - Expo caches
|
39
|
+
# - ~/.cache
|
30
40
|
|
31
41
|
# ==== CONFIGURATION DEFAULTS - change as needed ====
|
32
42
|
CONFIGFILE="${HOME}/.config/mikes-macos-disk-cleanup.env" # you'll be prompted to create this if it doesn't exist
|
@@ -179,6 +189,36 @@ source "${DIR}/modules/android-avd.sh"
|
|
179
189
|
# Homebrew Caches
|
180
190
|
source "${DIR}/modules/homebrew-caches.sh"
|
181
191
|
|
192
|
+
# Golang Caches
|
193
|
+
source "${DIR}/modules/golang-cache.sh"
|
194
|
+
|
195
|
+
# Cargo Caches
|
196
|
+
source "${DIR}/modules/cargo-cache.sh"
|
197
|
+
|
198
|
+
# MediaAnalysisD cache
|
199
|
+
source "${DIR}/modules/mediaanalysisd.sh"
|
200
|
+
|
201
|
+
# MobileSMS temp files
|
202
|
+
source "${DIR}/modules/mobilesmstmp.sh"
|
203
|
+
|
204
|
+
# MS Teams temp files
|
205
|
+
source "${DIR}/modules/msteams.sh"
|
206
|
+
|
207
|
+
# Messages Previews cache
|
208
|
+
source "${DIR}/modules/messagespreviews.sh"
|
209
|
+
|
210
|
+
# Log files
|
211
|
+
source "${DIR}/modules/logs.sh"
|
212
|
+
|
213
|
+
# VSCode Extensions
|
214
|
+
source "${DIR}/modules/vscodeextensions.sh"
|
215
|
+
|
216
|
+
# Expo caches
|
217
|
+
source "${DIR}/modules/expo.sh"
|
218
|
+
|
219
|
+
# ~/.cache
|
220
|
+
source "${DIR}/modules/dotcache.sh"
|
221
|
+
|
182
222
|
# ======
|
183
223
|
# Now run all our modules
|
184
224
|
cocoapods
|
@@ -193,6 +233,16 @@ gradleShared
|
|
193
233
|
nodeModules
|
194
234
|
rubyGems
|
195
235
|
dockerFiles
|
236
|
+
goCaches
|
237
|
+
cargoCaches
|
238
|
+
mediaanalysisd
|
239
|
+
mobilesmstmp
|
240
|
+
msteams
|
241
|
+
messagespreviews
|
242
|
+
logs
|
243
|
+
vscodeextensions
|
244
|
+
expo
|
245
|
+
dotcache
|
196
246
|
androidBuildFolders
|
197
247
|
set +e ; # don't exit on error
|
198
248
|
androidSDK
|
@@ -0,0 +1,40 @@
|
|
1
|
+
cargoCaches() {
|
2
|
+
# cargo cache
|
3
|
+
command -v cargo >/dev/null 2>&1 && {
|
4
|
+
if [ -d ${HOME}/.cargo/registry ]; then
|
5
|
+
local CARGO_CACHE_SIZE=$(du -hs ${HOME}/.cargo/registry)
|
6
|
+
echo "=== removing Cargo registry (${CARGO_CACHE_SIZE}) ==="
|
7
|
+
rm -rf ${HOME}/.cargo/registry
|
8
|
+
fi
|
9
|
+
|
10
|
+
# search the development folder for "Cargo.lock" files, and run "cargo clean"
|
11
|
+
# where we find them
|
12
|
+
|
13
|
+
local CARGO_LOCKFILES=$(
|
14
|
+
find -E "${DEVELOPMENT_BASE_DIR}" -type f -name Cargo.lock \
|
15
|
+
-not -regex "^.*node_modules.+"
|
16
|
+
)
|
17
|
+
echo " - found cargo lock files; cleaning related 'target' folders..."
|
18
|
+
IFS=$'\n' # make newlines the only separator
|
19
|
+
local MODULESWERE_REMOVED=0
|
20
|
+
|
21
|
+
for CARGO_LOCKFILE in ${CARGO_LOCKFILES}; do
|
22
|
+
MODULESWERE_REMOVED=1
|
23
|
+
local CARGO_FOLDER=$(dirname ${CARGO_LOCKFILE})
|
24
|
+
local TARGET="${CARGO_FOLDER}/target"
|
25
|
+
if [ -d ${TARGET} ]; then
|
26
|
+
local TARGET_SIZE=$(du -hs "${TARGET}" | cut -f1)
|
27
|
+
printf " - removing '${TARGET}' (${TARGET_SIZE}) ... "
|
28
|
+
rm -rf "${TARGET}"
|
29
|
+
echo "done"
|
30
|
+
fi
|
31
|
+
done
|
32
|
+
unset IFS
|
33
|
+
if [ ${MODULESWERE_REMOVED} -eq 1 ]; then
|
34
|
+
addHint "- You will need to re-run cargo in each of your projects"
|
35
|
+
fi
|
36
|
+
} || {
|
37
|
+
echo "=== 'cargo' command not found; continuing... ==="
|
38
|
+
|
39
|
+
}
|
40
|
+
}
|
package/modules/docker-files.sh
CHANGED
@@ -5,13 +5,21 @@ dockerFiles() {
|
|
5
5
|
local DOCKER_RUNNING=0;
|
6
6
|
docker version && DOCKER_RUNNING=1 || DOCKER_RUNNING=0;
|
7
7
|
if [ ! $DOCKER_RUNNING == 1 ]; then
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
echo " INFO: docker daemon not running; attempting to start docker desktop ..."
|
10
|
+
command docker desktop start >/dev/null 2>&1 && {
|
11
|
+
DOCKER_RUNNING=1
|
12
|
+
} || {
|
13
|
+
echo "======= ERROR: docker daemon not running and couldn't start; skipping docker cleanup ======="
|
14
|
+
}
|
15
|
+
fi
|
16
|
+
|
17
|
+
if [ $DOCKER_RUNNING == 1 ]; then
|
10
18
|
echo " BEFORE DOCKER CLEANUP:"
|
11
19
|
docker system df
|
12
20
|
# remove all docker artifacts
|
13
21
|
echo " = removing all docker containers"
|
14
|
-
docker ps -a -q | xargs -r docker rm
|
22
|
+
docker ps -a -q | xargs -r docker rm -—force
|
15
23
|
|
16
24
|
echo " = removing all docker images"
|
17
25
|
docker image prune --all --force
|
@@ -31,6 +39,8 @@ dockerFiles() {
|
|
31
39
|
docker system df
|
32
40
|
|
33
41
|
fi
|
42
|
+
} || {
|
43
|
+
echo "=== 'docker' command not found; continuing... ==="
|
34
44
|
}
|
35
45
|
|
36
46
|
}
|
package/modules/expo.sh
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
expo(){
|
2
|
+
local CACHEFOLDER="${HOME}/.expo/ios-simulator-app-cache"
|
3
|
+
if [ -d "${CACHEFOLDER}" ]; then
|
4
|
+
local SIZEBEFORE=$(du -hs "${CACHEFOLDER}" | cut -f1)
|
5
|
+
echo "=== removing ${SIZEBEFORE} of Expo iOS Simulator App caches ==="
|
6
|
+
rm -rf "${CACHEFOLDER}"
|
7
|
+
fi
|
8
|
+
CACHEFOLDER="${HOME}/.expo/android-apk-cache"
|
9
|
+
if [ -d "${CACHEFOLDER}" ]; then
|
10
|
+
local SIZEBEFORE=$(du -hs "${CACHEFOLDER}" | cut -f1)
|
11
|
+
echo "=== removing ${SIZEBEFORE} of Expo Android APK caches ==="
|
12
|
+
rm -rf "${CACHEFOLDER}"
|
13
|
+
fi
|
14
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
goCaches() {
|
2
|
+
# go cache
|
3
|
+
command -v go >/dev/null 2>&1 && {
|
4
|
+
# Go Build Cache
|
5
|
+
local GOBUILD_CACHE=$(go env GOCACHE);
|
6
|
+
# Go module download cache
|
7
|
+
local GOMOD_CACHE=$(go env GOMODCACHE);
|
8
|
+
|
9
|
+
if [ -d "${GOBUILD_CACHE}" ]; then
|
10
|
+
local GOBUILD_CACHE_SIZE=$(du -hs ${GOBUILD_CACHE});
|
11
|
+
echo "=== removing Go Build Cache (${GOBUILD_CACHE_SIZE}) ==="
|
12
|
+
go clean -cache
|
13
|
+
fi
|
14
|
+
|
15
|
+
if [ -d "${GOMOD_CACHE}" ]; then
|
16
|
+
local GOMOD_CACHE_SIZE=$(du -hs ${GOMOD_CACHE});
|
17
|
+
echo "=== removing Go Module Cache (${GOMOD_CACHE_SIZE}) ==="
|
18
|
+
go clean -modcache
|
19
|
+
fi
|
20
|
+
} || {
|
21
|
+
echo "=== 'go' command not found; continuing... ==="
|
22
|
+
}
|
23
|
+
}
|
@@ -25,7 +25,6 @@ homebrewCaches(){
|
|
25
25
|
local SIZEAFTER=$(du -hs ${HOME}/Library/Caches/Homebrew | cut -f1)
|
26
26
|
echo " cache size before: ${SIZEBEFORE}; after: ${SIZEAFTER}"
|
27
27
|
} || {
|
28
|
-
|
29
|
-
return 1;
|
28
|
+
echo "=== 'brew' command not found; continuing... ==="
|
30
29
|
}
|
31
30
|
}
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# Usage:
|
2
|
+
# export CACHEPATH=$(realpath $HOME/Library/Caches );
|
3
|
+
# lsof -w -b +c 32 -n | awk -v CACHEPATH=$CACHEPATH -f library-caches-lsof-output.awk
|
4
|
+
|
5
|
+
function getProcessNames(retString) {
|
6
|
+
for(proc in processes) {
|
7
|
+
if (proc != ""){
|
8
|
+
retString=retString""sprintf("%s:", proc);
|
9
|
+
# retString=retString""processes[proc];
|
10
|
+
split(processes[proc], theseFolders, ";");
|
11
|
+
for(folder in theseFolders) {
|
12
|
+
if (theseFolders[folder] != "" && (theseFolders[folder] in folderSizes)) {
|
13
|
+
retString=retString""sprintf("%s (%'dKB),", theseFolders[folder], folderSizes[theseFolders[folder]]);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
retString=retString"\n";
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return retString;
|
20
|
+
}
|
21
|
+
|
22
|
+
function getCacheFoldersByName(retString) {
|
23
|
+
for(cacheFolder in folders) {
|
24
|
+
if (cacheFolder != "" && (cacheFolder in folderSizes)) {
|
25
|
+
retString=retString""sprintf("%s (%'dKB):", cacheFolder, folderSizes[cacheFolder]);
|
26
|
+
retString=retString""folders[cacheFolder];
|
27
|
+
# split(folders[cacheFolder], theseProcesses, ";");
|
28
|
+
# for(proc in theseProcesses) {
|
29
|
+
# if (theseProcesses[proc] != "") {
|
30
|
+
# retString=retString""sprintf("%s,", theseProcesses[proc]);
|
31
|
+
# }
|
32
|
+
# }
|
33
|
+
retString=retString"\n";
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return retString;
|
37
|
+
}
|
38
|
+
|
39
|
+
function getCacheFoldersBySize(retString) {
|
40
|
+
for(cacheFolder in folders) {
|
41
|
+
if (cacheFolder != "" && (cacheFolder in folderSizes)) {
|
42
|
+
retString=retString""sprintf("%s (%'dKB)%s:", folderSizes[cacheFolder], folderSizes[cacheFolder], cacheFolder);
|
43
|
+
retString=retString""folders[cacheFolder];
|
44
|
+
# split(folders[cacheFolder], theseProcesses, ";");
|
45
|
+
# for(proc in theseProcesses) {
|
46
|
+
# if (theseProcesses[proc] != "") {
|
47
|
+
# retString=retString""sprintf("%s,", theseProcesses[proc]);
|
48
|
+
# }
|
49
|
+
# }
|
50
|
+
retString=retString"\n";
|
51
|
+
}
|
52
|
+
}
|
53
|
+
return retString;
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
BEGIN {
|
58
|
+
if (CACHEPATH == "") {
|
59
|
+
CACHEPATH=$HOME"/Library/Caches";
|
60
|
+
}
|
61
|
+
delete processes[0]; # initializes a new array
|
62
|
+
delete folders[0]; # initializes a new array
|
63
|
+
delete folderSizes[0]; # initializes a new array
|
64
|
+
totalSizesOfFoldersInUse = 0;
|
65
|
+
}
|
66
|
+
|
67
|
+
($9 ~ CACHEPATH) &&
|
68
|
+
!($9 ~ "com.apple.") &&
|
69
|
+
!($9 ~ "CloudKit") &&
|
70
|
+
!($9 ~ "familycircled") &&
|
71
|
+
!($9 ~ "GeoServices") {
|
72
|
+
pathcopy = $9;
|
73
|
+
gsub(CACHEPATH"/", "", pathcopy);
|
74
|
+
gsub(/\/.*$/, "", pathcopy);
|
75
|
+
processName = $1;
|
76
|
+
libraryCacheFolder = pathcopy;
|
77
|
+
# printf("%s\t%s\n", processName, libraryCacheFolder);
|
78
|
+
if (processName in processes) {
|
79
|
+
existingFolderValsString = processes[processName];
|
80
|
+
split(existingFolderValsString, existingFolderValsArray, ";");
|
81
|
+
recorded = 0;
|
82
|
+
for(thisFolderIdx in existingFolderValsArray) {
|
83
|
+
if (existingFolderValsArray[thisFolderIdx] == libraryCacheFolder) {
|
84
|
+
recorded = 1;
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
if (recorded == 0) {
|
89
|
+
processes[processName] = processes[processName]";"libraryCacheFolder;
|
90
|
+
}
|
91
|
+
} else {
|
92
|
+
if (processName != "" && libraryCacheFolder != "") {
|
93
|
+
processes[processName]=libraryCacheFolder;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
if (libraryCacheFolder in folders) {
|
97
|
+
existingProcessValsString = folders[libraryCacheFolder];
|
98
|
+
split(existingProcessValsString, existingProcessValsArray, ";");
|
99
|
+
recorded = 0;
|
100
|
+
for(thisProcIdx in existingProcessValsArray) {
|
101
|
+
if (existingProcessValsArray[thisProcIdx] == processName) {
|
102
|
+
recorded = 1;
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
if (recorded == 0) {
|
107
|
+
folders[libraryCacheFolder] = folders[libraryCacheFolder]";"processName
|
108
|
+
}
|
109
|
+
} else {
|
110
|
+
if (processName != "" && libraryCacheFolder != "") {
|
111
|
+
folders[libraryCacheFolder]=processName;
|
112
|
+
# get disk size
|
113
|
+
# -ks : summary in kilobytes; -t 5M : threshold of 5MB
|
114
|
+
# duCmd = "du -n -x -ks -t 5M "CACHEPATH"/"libraryCacheFolder" 2>/dev/null | cut -f1" ;
|
115
|
+
duCmd = "du -n -x -ks "CACHEPATH"/"libraryCacheFolder" 2>/dev/null | cut -f1" ;
|
116
|
+
duCmd | getline duOutput;
|
117
|
+
close(duCmd);
|
118
|
+
folderSizes[libraryCacheFolder] = duOutput;
|
119
|
+
totalSizesOfFoldersInUse += duOutput;
|
120
|
+
# printf("DUCMD: %s\n", duCmd)
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
END {
|
125
|
+
printf(" --- PROCESSES USING CACHE FILES: ---\n");
|
126
|
+
# printf(getProcessNames()) | "sort";
|
127
|
+
# fflush();
|
128
|
+
# printf("\n");
|
129
|
+
# printf(" --- CACHE FOLDERS IN USE (By NAME): ---\n");
|
130
|
+
# printf(getCacheFoldersByName()) | "sort";
|
131
|
+
# fflush();
|
132
|
+
# printf("\n");
|
133
|
+
printf(" --- CACHE FOLDERS IN USE (By SIZE): ---\n");
|
134
|
+
printf(getCacheFoldersBySize()) | "sort -rn";
|
135
|
+
fflush();
|
136
|
+
printf("\n");
|
137
|
+
printf (" --- TOTAL SIZE OF FOLDERS IN USE: %s KB\n", totalSizesOfFoldersInUse);
|
138
|
+
}
|
@@ -1,6 +1,31 @@
|
|
1
1
|
# remove everything in ~/Library/Caches
|
2
2
|
libraryCaches() {
|
3
|
-
local
|
4
|
-
|
5
|
-
|
3
|
+
local THISMODULEDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
4
|
+
local CACHEPATH=$(realpath $HOME/Library/Caches );
|
5
|
+
echo "=== emptying ~/Library/Caches... ==="
|
6
|
+
# # find files in use
|
7
|
+
# lsof -w -b +c 32 -n | \
|
8
|
+
# awk -v CACHEPATH=$CACHEPATH \
|
9
|
+
# -f ${THISMODULEDIR}/library-caches-lsof-output.awk
|
10
|
+
|
11
|
+
|
12
|
+
local LIBRARYCACHESIZE=$((du -hs "${HOME}/Library/Caches" 2>/dev/null | cut -f1 ) || echo "ERROR: COULD NOT RUN 'du'")
|
13
|
+
echo " Library Caches size: ${LIBRARYCACHESIZE}"
|
14
|
+
|
15
|
+
# now for ~/.cache
|
16
|
+
if [ -d ${HOME}/.cache ]; then
|
17
|
+
CACHEPATH=$(realpath $HOME/.cache )
|
18
|
+
echo "=== emptying ${CACHEPATH}... ==="
|
19
|
+
# find files in use
|
20
|
+
# lsof -w -b +c 32 -n | \
|
21
|
+
# awk -v CACHEPATH=$CACHEPATH \
|
22
|
+
# -f ${THISMODULEDIR}/library-caches-lsof-output.awk
|
23
|
+
|
24
|
+
|
25
|
+
LIBRARYCACHESIZE=$((du -hs "${CACHEPATH}" 2>/dev/null | cut -f1 ) || echo "ERROR: COULD NOT RUN 'du'")
|
26
|
+
echo " ${CACHEPATH} size: ${LIBRARYCACHESIZE}"
|
27
|
+
fi
|
28
|
+
|
29
|
+
rm -rf "${HOME}/Library/Caches" || echo "=== ERROR! COULD NOT empty ~/Library/Caches. Continuing. ==="
|
30
|
+
rm -rf "${HOME}/.cache" || echo "=== ERROR! COULD NOT empty ~/.cache. Continuing. ==="
|
6
31
|
}
|
package/modules/logs.sh
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
mediaanalysisd(){
|
2
|
+
local CACHEFOLDER="${HOME}/Library/Containers/com.apple.mediaanalysisd/Data/Library/Caches"
|
3
|
+
if [ -d "${CACHEFOLDER}" ]; then
|
4
|
+
local SIZEBEFORE=$(du -hs ${HOME}/Library/Containers/com.apple.mediaanalysisd/Data/Library/Caches | cut -f1)
|
5
|
+
echo "=== removing ${SIZEBEFORE} from mediaanalysisd Cache ==="
|
6
|
+
rm -rf "${CACHEFOLDER}"
|
7
|
+
fi
|
8
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
messagespreviews(){
|
2
|
+
local CACHEFOLDER="${HOME}/Library/Messages/Caches"
|
3
|
+
if [ -d "${CACHEFOLDER}" ]; then
|
4
|
+
|
5
|
+
local SIZEBEFORE=$(du -hs "${CACHEFOLDER}" | cut -f1)
|
6
|
+
echo "=== removing ${SIZEBEFORE} from Messages Preview cache ==="
|
7
|
+
rm -rf "${CACHEFOLDER}"
|
8
|
+
fi
|
9
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
mobilesmstmp(){
|
2
|
+
local CACHEFOLDER="${HOME}/Library/Containers/com.apple.MobileSMS/Data/tmp"
|
3
|
+
if [ -d "${CACHEFOLDER}" ]; then
|
4
|
+
local SIZEBEFORE=$(du -hs "${CACHEFOLDER}" | cut -f1)
|
5
|
+
echo "=== removing ${SIZEBEFORE} of MobileSMS temp files ==="
|
6
|
+
rm -rf "${CACHEFOLDER}"
|
7
|
+
fi
|
8
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
msteams(){
|
2
|
+
local CACHEFOLDER="${HOME}/Library/Containers/com.microsoft.teams2/Data/Library/Application Support/Microsoft/MSTeams/EBWebView"
|
3
|
+
if [ -d "${CACHEFOLDER}" ]; then
|
4
|
+
|
5
|
+
echo "=== removing MS Teams Caches ==="
|
6
|
+
local SIZEBEFORE=$(du -hs "${CACHEFOLDER}" | cut -f1)
|
7
|
+
echo " SIZE BEFORE: ${SIZEBEFORE}..."
|
8
|
+
rm -rf "${CACHEFOLDER}/WV2Profile_tfw/Service Worker/CacheStorage"
|
9
|
+
rm -rf "${CACHEFOLDER}/WV2Profile_tfl/Service Worker/CacheStorage"
|
10
|
+
local SIZEAFTER=$(du -hs "${CACHEFOLDER}" | cut -f1)
|
11
|
+
echo " SIZE AFTER: ${SIZEAFTER}..."
|
12
|
+
fi
|
13
|
+
}
|
package/modules/ruby-gems.sh
CHANGED
@@ -41,8 +41,10 @@ rubyGems() {
|
|
41
41
|
|
42
42
|
unset IFS
|
43
43
|
rvm use
|
44
|
+
addHint "- You might need to reinstall your ruby gems"
|
45
|
+
addHint " - e.g. gem install cocoapods"
|
46
|
+
} || {
|
47
|
+
echo "=== 'rvm' command not found; continuing... ==="
|
44
48
|
}
|
45
49
|
|
46
|
-
addHint "- You might need to reinstall your ruby gems"
|
47
|
-
addHint " - e.g. gem install cocoapods"
|
48
50
|
}
|
@@ -1,42 +1,47 @@
|
|
1
1
|
xcodeArtifacts() {
|
2
|
+
local DEVELOPERDIR="${HOME}/Library/Developer"
|
2
3
|
# ### XCode ###
|
3
|
-
if [ -d ${
|
4
|
+
if [ -d ${DEVELOPERDIR}/Xcode ]; then
|
4
5
|
echo "=== clearing Xcode folders ==="
|
5
6
|
|
6
7
|
# Xcode DerivedData
|
7
|
-
|
8
|
-
|
8
|
+
local DERIVEDDATADIR="${DEVELOPERDIR}/Xcode/DerivedData"
|
9
|
+
if [ -d "${DERIVEDDATADIR}" ]; then
|
10
|
+
local XCDDSIZE=$(du -hs "${DERIVEDDATADIR}" | cut -f1)
|
9
11
|
echo " removing Xcode DerivedData(${XCDDSIZE})..."
|
10
|
-
rm -rf ${
|
12
|
+
rm -rf "${DERIVEDDATADIR}"
|
11
13
|
fi
|
12
14
|
|
13
15
|
# Xcode DeviceLogs
|
14
|
-
|
15
|
-
|
16
|
+
local DEVICELOGDIR="${DEVELOPERDIR}/Xcode/DeviceLogs"
|
17
|
+
if [ -d "${DEVICELOGDIR}" ]; then
|
18
|
+
local XCDLSIZE=$(du -hs "${DEVICELOGDIR}" | cut -f1)
|
16
19
|
echo " removing Xcode DeviceLogs (${XCDLSIZE})..."
|
17
|
-
rm -rf ${
|
20
|
+
rm -rf "${DEVICELOGDIR}"
|
18
21
|
fi
|
19
22
|
|
20
23
|
# Xcode DeviceLogs
|
21
|
-
|
22
|
-
|
24
|
+
local SIMULATORCACHEDIR="${DEVELOPERDIR}/CoreSimulator/Caches"
|
25
|
+
if [ -d "${SIMULATORCACHEDIR}" ]; then
|
26
|
+
local XCCACHESIZE=$(du -hs "${SIMULATORCACHEDIR}" | cut -f1)
|
23
27
|
echo " removing Xcode CoreSimulator Caches (${XCCACHESIZE})..."
|
24
|
-
rm -rf ${
|
28
|
+
rm -rf "${SIMULATORCACHEDIR}"
|
25
29
|
fi
|
26
30
|
|
27
31
|
# iOS device support files
|
28
|
-
|
32
|
+
local DEVICESUPPORTDIR="${DEVELOPERDIR}/Xcode/iOS DeviceSupport"
|
33
|
+
if [ -d "${DEVICESUPPORTDIR}" ]; then
|
29
34
|
# display commands to remove iOS device support files (but don't actually remove);
|
30
35
|
# e.g. this would display something like:
|
31
36
|
# - This command would recover 3812 megabytes:
|
32
37
|
# rm -rf "/Users/me/Library/Developer/Xcode/iOS DeviceSupport/iPhone12,8 17.6.1 (21G93)"
|
33
38
|
local DEVICESUPPORTCOMMAND=$(
|
34
|
-
du -hs "${
|
39
|
+
du -hs "${DEVICESUPPORTDIR}"/* |
|
35
40
|
awk '{\
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
r=$0;\
|
42
|
+
gsub(/^[^[:space:]]+[[:space:]]+/,"",r);\
|
43
|
+
printf("- This command would recover an additional %s:\n rm -rf \"%s\"\n",$1, r);\
|
44
|
+
}'
|
40
45
|
)
|
41
46
|
echo "${DEVICESUPPORTCOMMAND}"
|
42
47
|
addHint "${DEVICESUPPORTCOMMAND}"
|
package/modules/yarn-cache.sh
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
yarnCache() {
|
2
2
|
# yarn cache
|
3
3
|
command -v yarn >/dev/null 2>&1 && {
|
4
|
+
yarn set version classic
|
4
5
|
local YARNCACHEDIR=$(yarn cache dir)
|
5
6
|
local YARNSIZE=$(du -hs ${YARNCACHEDIR} | cut -f1)
|
6
|
-
echo "=== removing yarn cache ${YARNCACHEDIR} (${YARNSIZE}) ==="
|
7
|
+
echo "=== removing yarn 'classic' cache ${YARNCACHEDIR} (${YARNSIZE}) ==="
|
7
8
|
yarn cache clean
|
9
|
+
yarn set version berry
|
10
|
+
YARNCACHEDIR=$(yarn config get cacheFolder)
|
11
|
+
YARNSIZE=$(du -hs ${YARNCACHEDIR} | cut -f1)
|
12
|
+
echo "=== removing yarn 'berry' cache ${YARNCACHEDIR} (${YARNSIZE}) ==="
|
13
|
+
yarn cache clean
|
14
|
+
} || {
|
15
|
+
echo "=== 'yarn' command not found; continuing... ==="
|
8
16
|
}
|
9
17
|
}
|
package/package.json
CHANGED