Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New Mac 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 homebrew..."
brew update
echo "Installing Git..."
brew install git
echo "Installing azureCli & Jq"
brew install azure-cli
brew install jq
brew install tree
#Install Zsh & Oh My Zsh
echo "Installing Oh My ZSH..."
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo "Installing additional bits"
apps=(
azure-data-studio
barrier
docker
firefox
insomnia
homebrew/cask-fonts/font-jetbrains-mono
homebrew/cask-fonts/font-jetbrains-mono-nerd-font
iterm2
keepassxc
microsoft-azure-storage-explorer
homebrew/cask-versions/microsoft-edge-beta
mission-control-plus
obs
powershell-preview
slack
snagit
spotify
spotmenu
typora
visual-studio-code-insiders
zoomus
)
# Install apps to /Applications
# Default is: /Users/$user/Applications
echo "installing apps with Cask..."
brew cask install --appdir="/Applications" ${apps[@]}
brew cleanup
# Install PowerLevel10k theme to ZSH folder
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# Download zshrc profile
curl -L https://gist.githubusercontent.com/brettmillerb/5f9197ce3568b230f52c9641d92f99bb/raw/3caff021b8c68b61c0a9b2a4bf06722aaebf989c/zshrc-theme > ~/.zshrc
# Setup Git Folders
mkdir -p git/gitpersonal
mkdir -p git/gitwork
# Set global git user name for personal account to be used with includeif
git config --global user.Name 'Brett Miller'
git config --global user.Email 'brett@millerb.co.uk'
# Rename to personal gitconfig (not sure how you can set other config files from cli)
mv ~/.gitconfig ~/.gitconfig-personal
# Set global includeif to avoid setting
git config --global includeif.gitdir/i:~/git/gitpersonal/.path '~/.gitconfig-personal'
git config --global user.name 'Brett Miller'
git config --global aliaslogline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global core.editor 'code-insiders --wait'
git config --global init.defaultBranch 'main'
echo "Preparing PowerShell Profile and Modules"
# Clone toolbox module from github (because I cba to publish it somewhere)
git clone https://github.com/brettmillerb/Toolbox.git git/gitpersonal/Toolbox
# build the module
pwsh -NoProfile git/gitpersonal/Toolbox/build.ps1
# Copy the built module to PSModulePath
cp -r git/gitpersonal/Toolbox/output/ .local/share/powershell/Modules/Toolbox
# Create $PROFILE.CurrentUserAllHosts directory and file
PROFILEPATH=/Users/brett.miller/.config/powershell
mkdir -p $PROFILEPATH
cd $PROFILEPATH
touch $PROFILEPATH/profile.ps1
echo "Installing pre-requisite modules for Profile loading"
pwsh -NoProfile -Command 'Install-Module Microsoft.PowerShell.UnixCompleters, Posh-Git, oh-my-posh'
# Download Pwsh profile
curl -L https://gist.githubusercontent.com/brettmillerb/467e4ee2d7f8e97897f106a5534f884b/raw/4a7f0dd3d5f243af8ec23343e38dff1cb7ec107b/profile.ps1 > ${HOME}/.config/powershell/profile.ps1
# Enable case insensitive auto-complete because screw case insensitivity
echo "set completion-ignore-case On" >> ~/.inputrc
# Setting Dock to auto-hide and removing the auto-hiding delay
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
killall dock
# Set default screen capture to clipboard
defaults write com.apple.screencapture target clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment