Last active
July 19, 2022 19:59
-
-
Save unicornware/ac9c3096c26f7c705dbd3dc6355ae911 to your computer and use it in GitHub Desktop.
Macbook Setup Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# PREREQUISITES | |
# backup machine with current setup | |
# SETUP | |
# set environment variables | |
# export DOPPLER_CONFIG= | |
# export DOPPLER_PROJECT= | |
# export DOPPLER_TOKEN= | |
# export HOST= | |
# export SSH_KEYGEN_EMAIL= | |
# export ZDOTDIR=$HOME/.config/zsh | |
# install cli tools for xcode | |
xcode-select —-install | |
# install rosetta 2 | |
sudo softwareupdate --install-rosetta --agree-to-license | |
# install homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# install brew bundle command | |
brew tap homebrew/bundle | |
# add brewfile | |
git clone https://github.com/unicornware/brewfile ~/.config/brewfile | |
# install applications and packages listed in brewfile | |
brew bundle | |
# install ohmyzsh | |
# https://github.com/ohmyzsh/ohmyzsh#advanced-installation | |
REPO=flex-development/ohmyzsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --keep-zshrc | |
# add system-wide .zshenv file | |
echo '# System-wide .zshenv file for zsh(1). | |
# | |
# Sourced on all invocations of the shell, unless the -f option is set. | |
# | |
# It should contain commands to set the command search path, as well as other | |
# important environment variables. It should not contain commands that produce | |
# output or assume the shell is attached to a tty. | |
# | |
# Global Order: zshenv, zprofile, zshrc, zlogin | |
# | |
# See: https://zsh.sourceforge.io/Intro/intro_3.html | |
# Change zsh startup files location | |
export ZDOTDIR=$ZDOTDIR' >> zshenv && sudo mv zshenv /etc | |
# backup existing .zshrc | |
mv $ZDOTDIR/.zshrc $ZDOTDIR/.zshrc.pre-oh-my-zsh || true | |
# add new .zshrc | |
cp $ZSH/templates/zshrc.zsh-template $ZDOTDIR/.zshrc | |
# add .zprofile | |
cp $ZSH/templates/zprofile.apple-silicon.zsh-template $ZDOTDIR/.zprofile | |
# add environment file | |
doppler secrets substitute $ZSH/templates/zshenv.zsh-template >> $ZDOTDIR/.zshenv | |
# set hostname | |
sudo hostname $HOST && sudo scutil --set HostName $HOST && sudo scutil --set LocalHostName $HOST | |
# install trash-cli (aliased to rm in ohmyzsh configuration) | |
# https://github.com/sindresorhus/trash-cli | |
yarn global add trash-cli | |
# reset shell | |
reset | |
# add .gitconfig | |
curl -o ~/.gitconfig https://gist.githubusercontent.com/unicornware/1efdc17c2cb301c721b227293dd19d62/raw/e5a4579be89feb36d8cbedebf79aba0f4a8cab5f/.gitconfig | |
# generate ssh key | |
ssh-keygen -t rsa -b 4096 -C $SSH_KEYGEN_EMAIL | |
# download and force install software updates | |
softwareupdate --all --install --force | |
# END SETUP | |
# POST-SETUP | |
# | |
# - finish setting up git | |
# - https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup | |
# - setup gpg for git | |
# - https://medium.com/@jma/setup-gpg-for-git-on-macos-4ad69e8d3733 | |
# - sync vscode settings | |
# - https://code.visualstudio.com/docs/editor/settings-sync | |
# - update environment file | |
# - code-insiders $ZDOTDIR/.zshenv | |
# - add custom zsh plugins | |
# - code-insiders $ZSH/custom | |
# - finish setting up and/or logging into applications | |
# - transfer files from backup to local machine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ZSH Configuration: https://gist.githubusercontent.com/unicornware/631cb4259847b67a231377bd58345763