Skip to content

Instantly share code, notes, and snippets.

@rishikrohan
Forked from rohithegde/mac-setup.sh
Created August 28, 2021 09:28
Show Gist options
  • Save rishikrohan/e48fb974d919c02de74ad44cbe5fc276 to your computer and use it in GitHub Desktop.
Save rishikrohan/e48fb974d919c02de74ad44cbe5fc276 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# Manual steps :
# Install Chrome : https://www.google.com/chrome/
# Customise System preferences (can use AppleScript to automate this too to some extent)
# - Keyboard for cursor speed and Touch Bar
# 1. Homebrew
sudo chown -R $(whoami) $(brew --prefix)/*
sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions
chmod u+w /usr/local/share/zsh /usr/local/share/zsh/site-functions
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# 2. Zsh is already installed on new Macs
chsh -s /bin/zsh
# 2a. Prezto framework
rm -rf "${ZDOTDIR:-$HOME}/.zprezto"
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -sf "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
# 2b. Zsh theme
# Install Fonts
wget -P ~/Library/Fonts https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
wget -P ~/Library/Fonts https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
wget -P ~/Library/Fonts https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
wget -P ~/Library/Fonts https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
echo 'ZSH_THEME="powerlevel10k/powerlevel10k"' >> ~/.zshrc
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
echo "zstyle ':prezto:module:prompt' theme 'powerlevel10k'" >> ~/.zpreztorc
# 3. Vim
# 3a. Package manager : vim-plug
wget -P ~/.vim/autoload/ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# 3b. Vim Plugins
mkdir -p ~/.vim/bundle
echo "call plug#begin('~/.vim/bundle')" >> ~/.vimrc
echo "Plug 'vim-airline/vim-airline'" >> ~/.vimrc
echo "Plug 'vim-airline/vim-airline-themes'" >> ~/.vimrc
echo "Plug 'preservim/nerdtree'" >> ~/.vimrc
echo "call plug#end()" >> ~/.vimrc
vim -E -s -u "$HOME/.vimrc" +PlugInstall +qall
# 4a. Useful tools to upgrade your cli exp
brew install wget htop tmux jq ncdu task gitleaks
brew tap cantino/mcfly
brew install mcfly
echo 'eval "$(mcfly init zsh)"' >> ~/.zshrc
# 5. Replace older tools
# 5a. Curl with openssl
brew uninstall curl
brew install curl-openssl
# 5b. Python3
brew install pyenv
brew install zlib
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.2 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
pyenv global 3.8.2
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
# 6. Visual Studio code
brew install --cask visual-studio-code
# get ext list with code --list-extensions >> vs_code_extensions_list.txt and upload it to github
wget https://gist.github.com/rohithegde/cb440b87f890145663016963e91774ae/raw/73de0705f1e35e3329347db88dab2569a450b428/vs-code-extensions-list-az-devops.txt
cat vs-code-extensions-list-az-devops.txt | xargs -n 1 code --install-extension
# 7. Azure
brew update && brew install azure-cli
brew install --cask powershell
# 8. Kubernetes and Istio
az aks install-cli
brew install derailed/k9s/k9s
sudo pip3 install kube-shell
brew install istioctl
# 9. Docker
brew install --cask docker
# 10. Terraform
brew install terraform
brew install terraform-docs
# 11. Git
brew install git
# 12. Golang
mkdir -p $HOME/code/research/golang
echo "export GOPATH=$HOME/code/research/golang" >> ~/.zshrc
echo "export GOROOT=/usr/local/opt/go/libexec" >> ~/.zshrc
echo "export PATH=$PATH:$GOPATH/bin" >> ~/.zshrc
echo "export PATH=$PATH:$GOROOT/bin" >> ~/.zshrc
brew install go
brew install dep
#13 Blog
sudo gem install jekyll bundler
# 14. Miscellaneous
# TF support for Zsh
echo "zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib" >> ~/.zpreztorc
git clone https://github.com/prezto-contributions/prezto-terraform.git ~/.zprezto-contrib/terraform
# MANUAL : add git, terraform to pmodule list
wget -P ~/ https://gist.github.com/rohithegde/7481ba88172233caa278969b4bb6605a/raw/aliases.txt
echo "source ~/aliases.txt" >> ~/.zshrc
brew install --cask netnewswire
# 15. Draw.io ie diagrams.net desktop app
wget https://github.com/jgraph/drawio-desktop/releases/download/v14.6.13/draw.io-14.6.13.dmg
echo "Please install the softwares present in the Downloads folder."
#NOTE : Your setup is present in files
#1. ~/.zshrc
#2. ~/.zpreztorc
#3. ~/aliases.txt
# 4. ~/.p10k.sh - will be created automatically once you start zsh for the first time and run through the p10k options.
# 16. Xcode from App Store
# Alternative is to install using Mac store CLI :
# brew install mas
# mas list
# mas search Xcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment