Create a Wordpress site from the command line with wp-cli
The first step is to install the wordpress command line tool. The below commands will download the package, grant the appropriate permissions for using the files and move the package to a place in our computer to a place where we can conveniently use it.
tl;dr — source code
$ 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
$ wp
After running these commands on your Mac or Unix-like system you should have the ability to use wp
from the command line.
Next create an empty project directory and download the Wordpress core codebase.
$ mkdir wordpress-local-site && cd wordpress-local-site
$ wp core download
By default this will generate a site for english, US (en_US). If you live in a different part of the world you can specify a locale (code list) by appending --locale=YOUR_COUNTRY_CODE
.
Next we can start the server and begin the famous five minute install by running:
$ wp server
This will start a PHP server and run the website we just downloaded on http://localhost:8080 in your browser. Next up we’ll have to let our brand new site know about the database that we’d like it to talk to.
In the installation process you will encounter this screen: