Skip to content

Instantly share code, notes, and snippets.

@paul-phan
Last active February 18, 2022 08:41
Show Gist options
  • Save paul-phan/b21286204ace6fef12ba969dda02c6c4 to your computer and use it in GitHub Desktop.
Save paul-phan/b21286204ace6fef12ba969dda02c6c4 to your computer and use it in GitHub Desktop.
Setup bootstrap for my Mac M1
#!/usr/bin/env bash
## You might need to make the script executable by run the following command mannually:
# sudo chmod +x ./m1-setup-dev.sh
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Make sure we’re using the latest Homebrew.
brew update
# Upgrade any already-installed formulae.
brew upgrade
brew install git
# Install Bash 4.
brew install bash
brew install bash-completion2
# Misc casks
brew install --cask --appdir="/Applications" google-chrome && true
brew install --cask --appdir="/Applications" firefox && true
brew install --cask --appdir="/Applications" visual-studio-code && true
brew install --cask betterzip
brew install docker
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
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 --lts
nvm use --lts
npm i -g @antfu/ni
# Remove outdated versions from the cellar.
brew cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment