forked from pathikrit/mac-setup-script
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·120 lines (100 loc) · 3.17 KB
/
setup.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
#!/usr/bin/env bash
#set +e # don't stop on error
set -e # stop on any error
set -x # show debug
echo "Install XCode CLI Tool"
if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
test -d "${xpath}" && test -x "${xpath}" ; then
echo "Xcode is installed ok"
else
echo "Xcode is NOT installed ok"
# xcode-select --install
# sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
# sudo xcodebuild -runFirstLaunch
fi
# Needed for compatibility in M1 Mac
sudo softwareupdate --install-rosetta --agree-to-license
echo "Install Homebrew"
if test ! $(which brew); then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/pal/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
brew update
echo "Install Homebrew Packages"
brew tap homebrew/bundle
brew bundle
brew doctor
brew link cocoapods
# Accept xcode license
sudo xcodebuild -license accept
echo "Set git defaults"
git_configs=(
"alias.br branch"
"alias.ci commit"
"alias.co checkout"
"alias.st status"
"branch.autoSetupRebase always"
"color.ui auto"
"core.autocrlf input"
"core.editor $(which code)"
"credential.helper osxkeychain"
"merge.conflictstyle diff3"
"merge.ff false"
"merge.tool diffmerge"
"mergetool.echo false"
"pull.rebase true"
"push.default simple"
"rebase.autostash true"
"rerere.autoUpdate true"
"rerere.enabled true"
"user.email [email protected]"
"user.name Pål Brattberg"
)
for config in "${git_configs[@]}"
do
git config --global ${config}
done
echo "Upgrade bash"
brew install bash bash-completion2 fzf
sudo bash -c "echo $(brew --prefix)/bin/bash >> /private/etc/shells"
#sudo chsh -s "$(brew --prefix)"/bin/bash
# Install https://github.com/twolfson/sexy-bash-echo
touch ~/.bash_profile #see https://github.com/twolfson/sexy-bash-echo/issues/51
(cd /tmp && git clone --depth 1 --config core.autocrlf=false https://github.com/twolfson/sexy-bash-echo && cd sexy-bash-echo && make install) && source ~/.bashrc
echo "Setting up fish shell ..."
brew install fish
echo $(which fish) | sudo tee -a /etc/shells
chsh -s $(which fish)
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
install 'omf install' ${omfs[@]}
echo "Install newer versions of dev languages"
# touch ~/.zshrc
# Add ruby
# echo 'frum init | source' > ~/.config/fish/conf.d/frum.fish
# echo 'eval "$(frum init)"' >> ~/.zshrc
# echo 'eval "$(frum init)"' >> ~/.bashrc
# frum init
# frum install 3.1.0
# frum global 3.1.0
# create ssh key
ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_rsa
# Add node using nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
nvm install lts/hydrogen
nvm alias default lts/hydrogen
nvm install 20
nvm use default
# cleanup
echo "Cleanup"
brew cleanup
brew cask cleanup
# Create my dev folder
mkdir ~/dev
# restore settings from iCloud (if this bugs out, allow time for iCloud sync)
cp /Users/pal/Library/Mobile\ Documents/com\~apple\~CloudDocs/Mackup/.mackup.cfg ~/
mackup restore --force
echo "Run [git_setup.sh] to fetch all you need to start coding!"
echo "Done!"