Skip to content

Instantly share code, notes, and snippets.

@kellylawrence
Created January 25, 2021 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellylawrence/20bccf488a23bd80c1463b1edc0feb1f to your computer and use it in GitHub Desktop.
Save kellylawrence/20bccf488a23bd80c1463b1edc0feb1f to your computer and use it in GitHub Desktop.
Bash script to help get a dev environment setup for new WP team members
#!/bin/bash
# Program:
# Helps get a dev environment setup for new WP team members.
# History:
# 16.Feb.2018 kellylawrence Add Homebrew install and fixed typos.
# 2.Feb.2018 chriswiseman Updated VS Code extensions.
bold=$(tput bold)
normal=$(tput sgr0)
tput setaf 3; echo "${bold}${yellow}Good morning, and welcome to the Black Mesa WP Dev Environment Setup System.${normal}"
sleep 3
echo "${bold}Install Xcode command line tools${normal}"
xcode-select --install
echo "${bold}Install Homebrew${normal}"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Seems to be required for various Homebrew things
echo "${bold}Set folder permissions${normal}"
sudo chown -R $(whoami) /usr/local/var/homebrew/locks
sudo chown -R $(whoami) /usr/local/share/man
sudo chown -R $(whoami) $(brew --prefix)/*
# Should already be installed, but better safe than sorry
echo "${bold}Install \"Git\"${normal}"
brew install git
echo "${bold}Upgrade \"Node\"${normal}"
brew upgrade node
echo "${bold}Upgrade \"npm\"${normal}"
brew upgrade npm
echo "${bold}Install \"Yarn\"${normal}"
brew install yarn
echo "${bold}Install Firefox${normal}"
brew cask install firefox
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Firefox.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; killall Dock
echo "${bold}Install iTerm2${normal}"
brew cask install iterm2
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/iTerm.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; killall Dock
echo "${bold}Install \"ZSH\"${normal}"
brew install zsh
echo "${bold}Set Zsh as default shell${normal}"
chsh -s /usr/local/bin/zsh
echo "${bold}Download Oh My Zsh${normal}"
curl -L http://install.ohmyz.sh | sh
echo "${bold}Install \"MySQL\"${normal}"
brew install mysql
# Start MySQL server and set it to always run on startup
echo "${bold}Start MySQL server${normal}"
mysql.server start
brew services start mysql
echo "${bold}Install \"Composer\"${normal}"
brew tap homebrew/dupes
brew tap homebrew/php
brew install composer
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc
source ~/.zshrc
echo "${bold}Install \"Valet\" and upgrade PHP${normal}"
brew install homebrew/core/php
composer global require laravel/valet
source ~/.zshrc
valet install
echo "${bold}Install VSCode${normal}"
brew cask install visual-studio-code
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Visual Studio Code.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; killall Dock
echo "${bold}Install VSCode extensions${normal}"
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension flowtype.flow-for-vscode
code --install-extension ikappas.phpcs
code --install-extension persoderlind.vscode-phpcbf
code --install-extension jpoissonnier.vscode-styled-components
code --install-extension kumar-harsh.graphql-for-vscode
code --install-extension neilbrayfield.php-docblocker
code --install-extension Orta.vscode-jest
code --install-extension PeterJausovec.vscode-docker
code --install-extension Shan.code-settings-sync
code --install-extension wayou.vscode-todo-highlight
code --install-extension whatwedo.twig
echo "${bold}Install \"WP-CLI\"${normal}"
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
echo "${bold}Set Valet Directory for Sites${normal}"
mkdir ~/Sites
cd ~/Sites
valet park
tput setaf 3; echo "${bold}Thank you, and have a very safe and productive day! λ"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment