Skip to content

Instantly share code, notes, and snippets.

@one000mph
Last active June 15, 2020 23:08
Show Gist options
  • Save one000mph/df1883b314b91f29ca4fd01e0fde01cc to your computer and use it in GitHub Desktop.
Save one000mph/df1883b314b91f29ca4fd01e0fde01cc to your computer and use it in GitHub Desktop.
new-machine-setup.sh
echo "Starting setup"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
echo "Updating Brew"
brew update
PACKAGES=(
autoconf
awscli
coreutils
docker-completion
ffmpeg
findutils
git
gnu-indent
gnu-sed
gnu-tar
gnu-which
go
grep
helm
jq
kubernetes-cli
kubernetes-helm
lua
[email protected]
luarocks
make
markdown
openssl
postgresql
python
python3
rclone
redis
sqlite
terraform
tmux
tree
vim
watch
wget
zsh
zsh-completions
zsh-git-prompt
)
echo "Checking & Installing brew packages..."
brew list ${PACKAGES[@]} > /dev/null || brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
CASKS=(
1password
android-messages
backblaze
docker
dropbox
firefox
flux
google-chrome
google-cloud-sdk
harvest
iterm2
keybase
postgres
rescuetime
skype
slack
spotify
visual-studio-code
vlc
zoomus
)
echo "Checking & Installing cask apps..."
brew cask list ${CASKS[@]} > /dev/null || brew cask install ${CASKS[@]}
echo "Install nvm and node"
if ! [ -x $(command -v nvm) ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
fi
if [ -x $( command -v nvm ) ]; then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install node
nvm use node
fi
if [ -x $( command -v git ) ]; then
mkdir -p ~/.ssh && cd ~/.ssh
echo "Generate keypair for git if there are no keys"
if ! [ -f id_rsa.pub ]; then
ssh-keygen -f id_rsa -t rsa -N ''
cat id_rsa.pub
echo "\n Generated ssh keypair at $(pwd). Please add this to your git user before proceeding"
exit 1
fi
echo "Cloning & Copying private config"
git clone -q [email protected]:one000mph/private.git || exit 1
cd private
mkdir -p ~/.kube
mkdir -p ~/.oh-my-zsh/custom
cp kubeconfig ~/.kube/config
cp gitconfig ~/.gitconfig
cp .zshrc ~/.zshrc
cp -R oh-my-zsh-custom/ ~/.oh-my-zsh/custom/
cp iTermDefault.json ~/Desktop
echo "iTermDefault profile is on the desktop. Load manually in iTerm2 prefs"
cd .. && rm -rf private
fi
echo "Setting MacOS defaults"
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
# Prevent left and right swipe through history in Chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
echo "Setting up Zsh, Oh My Zsh Themes, and Plugins"
if ! [ -d "/Users/$(whoami)/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
if ! [ -d "/Users/$(whoami)/.oh-my-zsh/custom/themes/powerlevel10k" ]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
fi
if ! [ -d "/Users/$(whoami)/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
fi
cd ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment