-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.command
executable file
·203 lines (166 loc) · 6.01 KB
/
install.command
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/bash
# <<COMMENT
# # Simple Installation of the latest Brew, Cask, Git, PHP, Composer, Node.js and lot of other apps/tools/libraries. #
# Download this file, and from the directory, run in terminal
# chmod +x install.command
# sudo ./install.command
# COMMENT
printf '\n\e[35m System settings... \e[0m\n'
# take screenshots as jpg (usually smaller size) and not png
defaults write com.apple.screencapture type jpg
# do not open previous previewed files (e.g. PDFs) when opening a new one
defaults write com.apple.Preview ApplePersistenceIgnoreState YES
# show Library folder
chflags nohidden ~/Library
# show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
# show path bar
defaults write com.apple.finder ShowPathbar -bool true
# show status bar
defaults write com.apple.finder ShowStatusBar -bool true
killall Finder
printf '\n\e[35m Create Work dir if it is not exist... \e[0m\n'
# shellcheck disable=SC2164
cd
mkdir -p ~/Work
if ! command -v brew &>/dev/null; then
printf '\n\e[35m Installing Homebrew, an OSX package manager, follow the instructions... \e[0m\n'
#Install Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(/opt/homebrew/bin/brew shellenv)"
echo 'export PATH="/opt/homebrew/bin:$PATH"' >>~/.zshrc
echo export PATH="/opt/homebrew/bin:$PATH"
# Make sure Brew has permissions
brew doctor
fi
printf '\n\e[35m Update brew... \e[0m\n'
# Update Brew
brew update
printf '\n\e[35m Install GUI applications... \e[0m\n'
brew install --cask \
cardhop \
fantastical \
alfred \
calibre \
anki \
discord \
slack \
skype \
zoom \
microsoft-office \
steam \
1password \
arc \
iterm2 \
rectangle \
ImageOptim \
visual-studio-code \
jetbrains-toolbox \
docker \
postman
printf '\n\e[35m Install terminal applications... \e[0m\n'
#@todo: Check/try out lsd
brew install \
coreutils \
wget \
lsd \
git \
git-flow \
gh \
composer \
node \
yarn \
vim \
php \
mysql \
symfony-cli/tap/symfony-cli \
libpq
# https://github.com/Homebrew/brew/blob/master/docs/FAQ.md#can-i-install-my-own-stuff-to-usrlocal
brew link --force libpq
printf '\n\e[35m Install xDebug... \e[0m\n'
pecl install xdebug
printf '\n\e[35m Install fonts... \e[0m\n'
brew install --cask font-hack-nerd-font
SSH_CONFIG_FILE=~/.ssh/config
if [ ! -f "$SSH_CONFIG_FILE" ]; then
printf "\n\e[35m Add SSH config file... \e[0m\n"
touch $SSH_CONFIG_FILE
fi
printf '\n\e[35m Git global setup... \e[0m\n'
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global init.defaultBranch main
#git config --list
printf "\n\e[35m Append SSH config file with demo setup... \e[0m\n"
printf '\n' >>$SSH_CONFIG_FILE
echo "#Host *" >>$SSH_CONFIG_FILE
echo "# Hostname github.com" >>$SSH_CONFIG_FILE
echo "# Identityfile ~/.ssh/id_rsa" >>$SSH_CONFIG_FILE
echo "# IdentitiesOnly yes" >>$SSH_CONFIG_FILE
DIR="/Users/$USER/.oh-my-zsh"
if [ ! -d "$DIR" ]; then
printf '\n\e[35m Install Oh My ZSH... \e[0m\n'
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
if [ -f ~/.zshrc ]; then
printf '\n\e[35m Backup .zshrc file... \e[0m\n'
cp ~/.zshrc ~/.zshrc.orig
fi
printf '\n\e[35m Create new .zshrc file from template... \e[0m\n'
wget https://raw.githubusercontent.com/Cenarius-io/MacSetupForDevelopment/master/.zshrc -O ~/.zshrc
printf '\n\e[35m Update Oh My ZSH... \e[0m\n'
omz update
fi
if [ ! -d "${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions" ]; then
printf '\n\e[35m Install zsh-completions plugin... \e[0m\n'
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
fi
if [ ! -d "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then
printf '\n\e[35m Install zsh-autosuggestions plugin... \e[0m\n'
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
fi
if [ ! -d "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" ]; then
printf '\n\e[35m Install zsh-syntax-highlighting plugin... \e[0m\n'
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
fi
if ! command -v starship &>/dev/null; then
printf '\n\e[35m Install Starship terminal theme... \e[0m\n'
brew install starship
fi
printf '\n\e[35m Load new config... \e[0m\n'
source ~/.zshrc
FILE=~/.zsh_aliases
if [ ! -f "$FILE" ]; then
printf '\n\e[35m Init ZSH aliases... \e[0m\n'
touch ~/.zsh_aliases
echo "# get machine's ip address" >>~/.zsh_aliases
echo 'alias ip="ipconfig getifaddr en0"' >>~/.zsh_aliases
echo "" >>~/.zsh_aliases
echo "# edit global zsh configuration" >>~/.zsh_aliases
echo 'alias zconfig="vim ~/.zshrc"' >>~/.zsh_aliases
echo "# edit global zsh_profile configuration" >>~/.zsh_aliases
echo "alias zprofile='vim ~/.zsh_profile'" >>~/.zsh_aliases
echo "# edit global zsh_aliases configuration" >>~/.zsh_aliases
echo "alias zaliases='vim ~/.zsh_aliases'" >>~/.zsh_aliases
echo "" >>~/.zsh_aliases
echo "# reload zsh configuration" >>~/.zsh_aliases
echo 'alias zsource="source ~/.zshrc"' >>~/.zsh_aliases
echo "# reload zsh configuration" >>~/.zsh_aliases
echo 'alias ohmyzsh="cd ~/.oh-my-zsh"' >>~/.zsh_aliases
echo "" >>~/.zsh_aliases
echo "# CDs" >>~/.zsh_aliases
echo "alias work='cd ~/Work'" >>~/.zsh_aliases
echo "" >>~/.zsh_aliases
echo "# Unix" >>~/.zsh_aliases
echo "alias c='clear'" >>~/.zsh_aliases
echo "" >>~/.zsh_aliases
echo "# LS Stuff" >>~/.zsh_aliases
echo "alias ls='gls -F -1 --color=auto --group-directories-first'" >>~/.zsh_aliases
echo "alias ll='ls -la'" >>~/.zsh_aliases
echo "alias ld='ls -d */'" >>~/.zsh_aliases
echo "alias la='ls -CA'" >>~/.zsh_aliases
fi
source ~/.zsh_aliases
if [ ! -f ~/.hushlogin ]; then
# Remove login info
sudo touch ~/.hushlogin
fi