-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosx.sh
executable file
·159 lines (124 loc) · 4.13 KB
/
osx.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env bash
# ~/osx.sh — Originally from https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished
# while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
###############################################################################
# General UI/UX #
###############################################################################
defaults write com.apple.finder AppleShowAllFiles YES
killall Finder
# Set computer name (as done via System Preferences → Sharing)
#sudo scutil --set ComputerName "0x6D746873"
#sudo scutil --set HostName "0x6D746873"
#sudo scutil --set LocalHostName "0x6D746873"
#sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873"
# Set standby delay to 24 hours (default is 1 hour or 3600)
#sudo pmset -a standbydelay 86400
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Step 1: Update the OS and Install Xcode Tools
echo "------------------------------"
echo "Updating OSX. If this requires a restart, run the script again."
# Install all available updates
sudo softwareupdate --all --install --force
#many tools require java preinstalled
if test ! $(which java); then
# Install Java since most apps require it
brew install --cask adoptopenjdk
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc
export CPPFLAGS="-I/usr/local/opt/openjdk/include"
else
brew install --cask adoptopenjdk
fi
# Xcode is Required:
if [[ ! -d "/Applications/Xcode.app" ]]; then
# Install Xcode App
brew install mas
mas list
mas install 497799835 # xcode
fi
echo "------------------------------"
# Install Xcode command line tools
if test ! $(which xcode-\select); then
check=$((xcode-\select --install) 2>&1)
echo $check
str="xcode-select: note: install requested for command line developer tools"
while [[ "$check" == "$str" ]];
do
echo "Installing Xcode Command Line Tools.";
osascript -e 'tell app "System Events" to display dialog "xcode command-line tools missing." buttons "OK" default button 1 with title "xcode command-line tools"'
exit;
done
fi
if has_path "Projects"; then
e_success "~/Projects"
else
mkdir ~/Projects
fi
# Install HomeBrew as PackageManager
# https://github.com/Homebrew/homebrew-cask/blob/master/USAGE.md
if test ! $(which brew); then
#if ! [ -x "$(command -v brew)" ]; then
echo "Installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
else
# Make sure we’re using the latest Homebrew.
brew update
# Upgrade any already-installed formulae.
brew upgrade
brew doctor
fi
brew install -f -g git
if test ! $(which git-flow); then
# Install git-flow
brew install git-flow
else
brew upgrade git-flow
fi
if [[ ! -d "/Applications/Github Desktop.app" ]]; then
# Install Github Desktop App
brew install --cask --appdir="/Applications" github-desktop
brew install --cask --appdir="/Applications" github
fi
if [[ ! -d "/Applications/Sourcetree.app" ]]; then
# Install Sourcetree
brew install --cask sourcetree
fi
if [[ ! -d "/Applications/Docker.app" ]]; then
# Install Docker
brew install docker
brew install docker-compose
fi
if [[ ! -d "/Applications/Google Chrome.app" ]]; then
# Install Chrome
brew install --cask --appdir="/Applications" google-chrome
fi
if [[ ! -d "/Applications/Brave Browser.app" ]]; then
# Install Brave
brew install --cask brave-browser
fi
if [[ ! -d "/Applications/Postman.app" ]]; then
# Install Postman
brew search postman
brew install --cask info postman
brew install --cask postman
else
brew upgrade postman
fi
if [[ ! -d "/Applications/Graphviz.app" ]]; then
brew install graphviz
else
brew upgrade graphviz
fi
if test ! $(which http); then
echo "Installing httpie"
brew install httpie
else
brew upgrade httpie
fi
# cleanup
brew cleanup -s
rm -f -r /Library/Caches/Homebrew/*