forked from andmpel/MacOS-All-In-One-Update-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-all.sh
113 lines (90 loc) · 2.44 KB
/
update-all.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
#!/bin/zsh
# To execute run:
#
# zsh update-all.sh
#
# To source and then use individual update-* functions
# first comment out the command at the bottom of the file
# and run:
#
# source ./update-all.sh
#
# If you want to use this command often copy it to directory
# that you have in PATH (check with `echo $PATH`) like this:
#
# USER_SCRIPTS="${HOME}/.local/bin" # change this
# cp ./update-all.sh $USER_SCRIPTS/update-all
# chmod +x $USER_SCRIPTS/update-all
#
# and now you can call the script any time :)
# Text Color Variables
GREEN='\033[32m' # Green
CLEAR='\033[0m' # Clear color and formatting
update-brew() {
if ! which brew &>/dev/null; then return; fi
echo -e "${GREEN}Updating Brew Formula's${CLEAR}"
brew update
brew upgrade
brew cleanup -s
echo -e "\n${GREEN}Updating Brew Casks${CLEAR}"
brew cask outdated
brew cask upgrade
brew cleanup -s
echo -e "\n${GREEN}Brew Diagnostics${CLEAR}"
brew doctor
brew missing
}
update-atom() {
if ! which apm &>/dev/null; then return; fi
echo -e "\n${GREEN}Updating Atom${CLEAR}"
apm upgrade -c false
}
update-npm() {
if ! which npm &>/dev/null; then return; fi
echo -e "\n${GREEN}Updating npm Packages${CLEAR}"
npm update -g
}
update-gem() {
if ! which gem &>/dev/null; then return; fi
echo -e "\n${GREEN}Updating gems${CLEAR}"
gem update --user-install
gem cleanup --user-install
}
update-yarn() {
if ! which yarn &>/dev/null; then return; fi
echo -e "${GREEN}Updating Brew Formula's${CLEAR}"
yarn upgrade --latest
}
update-pip2() {
if ! which pip2 &>/dev/null; then return; fi
echo -e "\n${GREEN}Updating Python 2.7.X pips${CLEAR}"
pip2 freeze - local | grep -v ‘^\-e’ | cut -d = -f 1 | xargs pip2 install -U
}
update-pip3() {
if ! which pip3 &>/dev/null; then return; fi
echo -e "\n${GREEN}Updating Python 3.X pips${CLEAR}"
pip3 freeze - local | grep -v ‘^\-e’ | cut -d = -f 1 | xargs pip3 install -U
}
update-app_store() {
if ! which mas &>/dev/null; then return; fi
echo -e "\n${GREEN}Updating App Store Applications${CLEAR}"
mas outdated
mas upgrade
}
update-macos() {
echo -e "\n${GREEN}Updating Mac OS${CLEAR}"
softwareupdate -i -a
}
update-all() {
update-brew
update-atom
update-npm
update-gem
update-yarn
update-pip2
update-pip3
update-app_store
update-macos
}
# COMMENT OUT IF SOURCING
update-all