-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmacupd
executable file
·55 lines (46 loc) · 1016 Bytes
/
macupd
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
#!/bin/bash
# macos: update os, applications, homebrew etc
command_exists() {
command -v "$1" >/dev/null 2>&1
}
update_homebrew() {
if command_exists brew; then
echo "homebrew housekeeping..."
brew update
brew upgrade
brew cleanup
brew doctor
outdated_casks=$(brew outdated --cask --greedy --quiet)
if [ -n "$outdated_casks" ]; then
echo "upgrading outdated casks..."
brew upgrade $outdated_casks
fi
else
echo "homebrew not found. skipping."
fi
}
update_npm() {
if command_exists npm; then
echo "updating npm packages globally..."
npm update -g
else
echo "npm not found. skipping."
fi
}
if [[ $(uname -s) != "Darwin" ]]; then
echo "script is for macOS only."
exit 1
fi
echo "updating OS..."
softwareupdate -i -a
if command_exists nmap; then
echo "updating nmap scriptdb..."
nmap --script-updatedb
fi
if command_exists tldr; then
echo "updating tldr pages..."
tldr --update
fi
update_homebrew
update_npm
echo "completed."