Last active
February 21, 2021 05:37
-
-
Save tonnylitao/9b0d96fff13f7c40c010da159275e468 to your computer and use it in GitHub Desktop.
a script to setup dev environment after new MacOS installed.
This file contains hidden or 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/bash | |
set -e | |
# before re-install Mac system, keep in mind: | |
# 1. exporting key and certificate keychain | |
# 2. iPhone/iPad backup files | |
# 3. WeChat message backup file | |
# 4. ~/.ssh | |
# then change the following git config and run this script | |
USER_NAME="" | |
USER_EMAIL="" | |
# packages will be installed by Brew | |
PACKAGES=( | |
git | |
node | |
fastlane | |
postgresql | |
yarn | |
zsh | |
curl | |
grep | |
zsh-syntax-highlighting | |
zsh-completions | |
ffmpeg | |
youtube-dl | |
nginx | |
sqlite | |
watchman # React Native | |
#swiftlint #need Xcode installed fist | |
) | |
# Apps will be installed by Brew | |
APPS=( | |
android-studio | |
android-file-transfer | |
android-platform-tools | |
atom | |
docker | |
firefox | |
github | |
google-chrome | |
iterm2 | |
macdown | |
notable | |
postman | |
sketch | |
zoom | |
wechatwebdevtools | |
mini-program-studio | |
ngrok | |
rectangle | |
db-browser-for-sqlite | |
pgadmin4 | |
adoptopenjdk/openjdk/adoptopenjdk8 # React Native | |
) | |
# Apps installed manually | |
OTHER_APPS=( | |
https://apps.apple.com/nz/app/xcode/id497799835?mt=12 | |
https://apps.apple.com/nz/app/id1496833156 | |
https://apps.apple.com/us/app/apple-configurator-2/id1037126344 | |
https://apps.apple.com/nz/app/pages/id409201541?mt=12 | |
https://apps.apple.com/nz/app/numbers/id409203825?mt=12 | |
https://www.eudic.net/v4/en/app/ting | |
) | |
# Atom packages | |
ATOM_PACKAGES=( | |
prettier-atom | |
linter | |
autocomplete | |
) | |
# Setup script for setting up a new macos machine | |
echo "Starting new Mac setup" | |
# install xcode CLI | |
xcode-select --install | |
# Check for Homebrew to be present, install if it's missing | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
# Update homebrew recipes | |
echo "Updating homebrew..." | |
brew update | |
echo "Installing packages..." | |
brew install ${PACKAGES[@]} | |
# Install apps to /Applications | |
echo "installing apps with Cask..." | |
brew install --cask ${APPS[@]} | |
brew cleanup | |
# Make chrome as default, may not work | |
open -a "Google Chrome" --args --make-default-browser | |
# Atom | |
apm install ${ATOM_PACKAGES[@]} | |
echo "Git config" | |
git config --global user.name $USER_NAME | |
git config --global user.email $USER_EMAIL | |
#echo "Creating an SSH key for you..." | |
ssh-keygen -t ed25519 -C $USER_EMAIL | |
#Start the ssh-agent in the background | |
ssh-agent -s | |
#Add your SSH private key to the ssh-agent and store your passphrase in the keychain | |
ssh-add -K ~/.ssh/id_ed25519 | |
#echo "Please add this public key to Github" | |
open https://github.com/account/ssh | |
read -p "Press [Enter] key after this..." | |
echo "Setting ZSH as shell..." | |
chsh -s $(which zsh) | |
/bin/bash -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# React Native | |
echo "export ANDROID_HOME=~/Library/Android/sdk | |
export PATH=$PATH:$ANDROID_HOME/emulator | |
export PATH=$PATH:$ANDROID_HOME/tools | |
export PATH=$PATH:$ANDROID_HOME/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/platform-tools" >> ~/.zshrc | |
echo "Done!🎉" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment