-
Notifications
You must be signed in to change notification settings - Fork 1
/
ox-os-macos.sh
142 lines (124 loc) · 3.24 KB
/
ox-os-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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash /bin/zsh
##########################################################
# config
##########################################################
if [[ $(arch) = "arm64" ]]; then
export TERMINFO=/usr/share/terminfo
else
export TERMINFO=/usr/local/share/terminfo
fi
##########################################################
# main
##########################################################
export CACHES=${HOME}/Library/Caches
export APPDATA="${HOME}/Library/Application Support"
update() {
printf "Installing needed updates.\n"
softwareupdate -i -a >/dev/null 2>&1
}
clean() {
case "$1" in
zsh)
printf "Cleaning up ZSH History.\n"
rm -rfv "${HOME}"/.zsh_sessions/*
rm -fv "${HOME}"/.zsh_history
;;
chrome)
printf "Cleaning up Chrome Cache.\n"
rm -rfv "${CACHES}"/Google/Chrome/*
;;
container)
printf "Cleaning Container Caches\n"
for ct in ${HOME}/Library/Containers; do
rm -rfv ~/Library/Containers/"$ct"/Data/Library/Caches/*
done
;;
volume)
printf "Emptying trash in Volumes.\n"
sudo rm -rfv /Volumes/*/.Trashes
;;
log)
printf "Emptying the system log files.\n"
sudo log erase
;;
*)
printf "Emptying trash.\n"
rm -rfv "${HOME}"/.Trash/*
;;
esac
}
allow() {
sudo spctl --master-disable
printf "Initial letter needs to be capitalized\n"
for app in /Applications/"$1"*.app; do
if [[ -z $app ]]; then
echo "$app not found."
else
echo "Cracking $app"
xattr -r -d com.apple.quarantine "$app"
fi
done
}
sign() {
for app in /Applications/"$1"*.app; do
if [[ -z $app ]]; then
echo "$app not found."
else
codesign --force --deep --sign - /Applications/"$app"
fi
done
}
hide() {
chflags hidden "$1"
}
##########################################################
# computer
##########################################################
shutdown() {
if [[ -z "$1" ]]; then
echo "Shutting down."
eval "sudo shutdown -h now"
else
echo "Shutting down in $1 seconds."
eval "sudo shutdown -h $1"
fi
}
restart() {
if [[ -z "$1" ]]; then
echo "Restarting."
eval "sudo shutdown -r now"
else
echo "Restarting in $1 seconds."
eval "sudo shutdown -r +$1"
fi
}
hibernate() {
echo "Hibernating."
shutdown -s now
}
sysinfo() {
sysctl -a | rg "$1"
}
##########################################################
# time machine
##########################################################
alias tmh="tmutil -h"
alias tms="tmutil startbackup"
alias tmq="tmutil stopbackup"
alias tmls="tmutil listbackups"
alias tmrm="tmutil delete"
##########################################################
# mas - app store
##########################################################
if test "$(command -v mas)"; then
alias mis="mas install"
alias mus="sudo mas uninstall"
alias mup="mas upgrade"
alias mh="mas help"
alias mif="mas info"
alias mls="mas list"
alias mst="mas outdated"
alias msc="mas search"
alias msi="mas signin"
alias mso="mas signout"
fi