Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 87 lines (66 sloc) 2.88 KB
# Setup HD local dev based on Laravel Valet+
# v1.1.2
bold=$(tput bold)
normal=$(tput sgr0)
## Safety first.
echo # Spacer.
echo "[] You are about to deploy a Mac local development environment."
echo "[] There are no prompts after this and very little error handling, so pay attention to the output."
read -p "[] ${bold}Are you sure you want to install?${normal} (y to continue) " -n 1 -r
echo # Spacer.
if [[ ! $REPLY =~ ^[Yy]$ ]]
echo "[] ${bold}Aborted by user. Bye.${normal}."
echo # Spacer.
exit 1
echo "[] There's going to be a lot of output from here... You may be prompted for your password, and to 'Allow' a firewall warning."
echo # Spacer.
## Prerequisites.
echo "[] Installing Homebrew if not available."
which -s brew
if [[ $? != 0 ]] ; then
/usr/bin/ruby -e "$(curl -fsSL"
echo "[] Updating Homebrew."
brew update
echo "[] Installing Git if not available."
which -s git || brew install git
echo "[] Installing PHP if not available."
if ! brew ls --versions php@7.1 > /dev/null; then
echo "Installing PHP 7.1."
brew install php@7.1
echo "[] Installing Composer if not available."
which -s composer || brew install composer
echo "[] Adding Composer to shell PATH."
[[ ":$PATH:" != *":$HOME/.composer/vendor/bin:"* ]] && PATH="${PATH}:$HOME/.composer/vendor/bin"
## Main event.
# Deploy Valet+.
if ! composer global show weprovide/valet-plus > /dev/null 2>&1; then
echo "[] Deploying Valet+."
composer global require weprovide/valet-plus
echo "[] Running Valet+ pre-launch checks."
valet fix
echo "[] Running Valet+ install."
valet install --with-mariadb
# Move to 7.2 - :( has to be done after install using 7.1.
#valet use 7.2
# Setup Valet+ sites.
echo "[] Creating ~/Sites to serve from."
if [[ -d "${sites_dir}" ]] ; then
echo "[] ${bold}~/Sites already exists but is presumed available. I am cautious so you will need to manually run 'valet park' in that folder if you are happy to use it. If not, run it in another directory, but you will have to modify to match.${normal}"
mkdir ${HOME}/Sites && cd ${HOME}/Sites && valet park > /dev/null 2>&1
## Happy days.
echo "Emails will be caught and can be seen at http://mailhog.test/."
echo "Any folder created in ~/Sites/ will be avilable at http://folder_name.test, but wouldn't it be easier if..."
# Icing on the cake - install
curl -o /usr/local/bin/ -fsSL ; chmod +x /usr/local/bin/
echo "[] Installing WP helper."
echo "Now just run to automate the cloning of a remote WP site to your machine."