When using the Sage way for developing Wordpress projects, there's a few requirements when setting up your local development environment.
- PHP
- Mysql
- Webserver (apache / nginx)
- Node version >= 12.18
(when using nvm execute
nvm list
to show current version, executenvm use stable
to switch to stable version if necessary, currently v15) - Yarn
- Composer
- Wp cli
- Git
Here's an example of how to install all requirements on Mac OS. It uses homebrew to install most of the required software, nvm to manage node versions, and laravel valet as webserver.
# install command line tools (including git)
xcode-select --install
# configure git global user
git config --global user.name <your-git-username>
git config --global user.email <your-git-email>
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# php + mysql
brew install php
brew install mysql
brew services start mysql
mysql --user='root' --execute='FLUSH PRIVILEGES;'
$(brew --prefix mysql)/bin/mysqladmin -u <your-mysql-username> password <your-mysql-password>
# composer
brew install composer
if ! grep -q 'PATH="~/.composer/vendor/bin:$PATH"' ~/.bash_profile ; then
echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
fi
# wp-cli
brew install wp-cli
# laravel valet
composer global require laravel/valet
valet install
valet start
valet domain localhost # optional, default domain extension is 'test'
# node version manager
brew install nvm
mkdir ~/.nvm
if ! grep -q 'NVM_DIR=~/.nvm' ~/.bash_profile ; then
echo 'export NVM_DIR=~/.nvm' >> ~/.bash_profile
source ~/.bash_profile
fi
if ! grep -q 'source $(brew --prefix nvm)/nvm.sh' ~/.bash_profile ; then
echo 'source $(brew --prefix nvm)/nvm.sh' >> ~/.bash_profile
source ~/.bash_profile
fi
nvm install # install latest node
nvm install --lts # install and load latest stable node
# yarn
brew install yarn