-
Notifications
You must be signed in to change notification settings - Fork 0
/
updating-software.sh
executable file
·72 lines (62 loc) · 2.24 KB
/
updating-software.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
#!/usr/bin/env bash
# These are my collection of custom commands for terminal.
# They are mainly to update software I use.
# Color Variables
RED='\033[0;31m'
NC='\033[0m' # No Color
# Update Homebrew
function up-brew () {
echo "\U1F4CC ${RED}==>${NC} Updating Homebrew \U1F37A with 'brew update' \U1F91E"
brew update
echo "\U1F4CC ${RED}==>${NC} Upgrading Homebrew \U1F37A with 'brew upgrade' \U1F91E"
brew upgrade
echo "\U1F4CC ${RED}==>${NC} Cleaning \U1F9FD with 'brew cleanup' \U1F91E"
brew cleanup
}
# Update R Packages
function up-r-packages () {
echo "\U1F4CC ${RED}==>${NC} Checking for new R packages \U1F4E6 \U1F91E"
if [ ! "$(Rscript --vanilla -e "old.packages(repos = 'cloud.r-project.org')")" = NULL ]; then
echo "\U1F4CC ${RED}==>${NC} The following R packages are outdated \U1F4DC"
Rscript --vanilla -e "as.data.frame(old.packages(repos = 'cloud.r-project.org'))[,c(3,5,4)]"
echo "\U1F4CC ${RED}==>${NC} Upgrading / building... \U1F3D7"
Rscript --vanilla -e "update.packages(ask = F, repos = 'cloud.r-project.org', checkBuild = T)"
else
echo "\U1F4CC ${RED}==>${NC} Nothing to update \U1F603"
fi
}
# Update all
function up-all () {
echo "\U1F4CC ${RED}==>${NC} Updating oh-my-zsh \U1F643 \U1F91E"
$ZSH/tools/upgrade.sh
up-brew
up-r-packages
echo "\U1F4CC ${RED}==>${NC} Updating Ruby \U1F48E gems \U1F91E"
gem update
# echo "\U1F4CC ${RED}==>${NC} updating macOS Apps in the App Mac Store \U1F5A5 \U1F91E"
# mas upgrade
# echo "\U1F4CC ${RED}==>${NC} updating macOS System \U1F5A5 \U1F91E"
# softwareupdate -i -a
}
# Link openBLAS to R binary
function r-openblas () {
# Figuring out the kind of machine
UNAME_MACHINE="$(/usr/bin/uname -m)"
if [[ "${UNAME_MACHINE}" == "arm64" ]]
then
# On ARM macOS, library is on /opt/homebrew
ln -sf \
/opt/homebrew/opt/openblas/lib/libopenblas.dylib \
/Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
else
# On Intel macOS, library is on /usr/local
ln -sf \
/usr/local/opt/openblas/lib/libopenblas.dylib \
/Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
fi
}
# Reinstall command line tools
function command-line-tools-reinstall {
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
}