A zero-friction WordPress site bootstrapper for local development with Laravel Herd.
Spin up a fully-configured, secured, plugin-loaded WordPress site at https://<sitename>.test with a single command.
newwp mycoolsite- What It Does
- Requirements
- Installation
- Configuration
- Usage
- What Happens Under the Hood
- Customizing the Defaults
- Optional Additions
- Troubleshooting
- Uninstalling a Site
In a single command, newwp will:
- ✅ Create a new site directory under
~/Herd/ - ✅ Download the latest WordPress core
- ✅ Create a fresh MySQL database
- ✅ Generate
wp-config.phpwith fresh salts, debug enabled, and revision limits - ✅ Install WordPress with your admin account
- ✅ Wipe default content (Hello World post, sample page, etc.)
- ✅ Remove bundled plugins (Hello Dolly, Akismet) and inactive themes
- ✅ Set timezone, disable comments/pingbacks, enable pretty permalinks
- ✅ Secure the site with HTTPS via Herd
- ✅ Install + activate every plugin you keep in
~/Scripts/zips/ - ✅ Open the login page in your browser
Total time: ~10 seconds.
| Tool | Purpose | Install |
|---|---|---|
| Bash 4+ | Script runtime | Pre-installed on macOS |
| Herd | Local PHP/MySQL/Nginx | herd.laravel.com |
| WP-CLI | WordPress command-line interface | brew install wp-cli |
| MySQL | Database server | Bundled with Herd Pro, or brew install mysql |
| unzip | Plugin zip extraction | Pre-installed on macOS |
Drop newwp.sh into ~/Scripts/ (or wherever you keep your shell scripts).
chmod +x ~/Scripts/newwp.shThe script reads database and admin credentials from ~/.config/newwp.env — never commit this file to git.
mkdir -p ~/.config
touch ~/.config/newwp.env
chmod 600 ~/.config/newwp.envOpen it in your editor and add:
# Database credentials (your local MySQL user)
DB_USER=root
DB_PASS=your_mysql_password
# WordPress admin account (used for every new site)
WP_ADMIN_USER=yourname
WP_ADMIN_EMAIL=you@example.com
WP_ADMIN_PASS=a_strong_password_here💡 The
chmod 600step locks the file to read/write for you only — important since it contains plaintext passwords.
mkdir -p ~/Scripts/zipsDrop any premium or pre-configured plugin .zip files in here. Every new site will get them auto-installed and activated. Leave the folder empty if you don't need this.
Add this to your ~/.zshrc:
alias newwp="~/Scripts/newwp.sh"Then reload:
source ~/.zshrcAll tunable values live in ~/.config/newwp.env:
| Variable | Description | Example |
|---|---|---|
DB_USER |
MySQL username | root |
DB_PASS |
MySQL password | secret123 |
WP_ADMIN_USER |
WordPress admin login | username |
WP_ADMIN_EMAIL |
WordPress admin email | you@example.com |
WP_ADMIN_PASS |
WordPress admin password | super_secure_pw |
Other settings (timezone, permalink structure, debug flags) are hardcoded in the script — see Customizing the Defaults.
newwp mysiteThis creates:
- A folder at
~/Herd/mysite/ - A database named
wp_mysite - A site reachable at
https://mysite.test
# Client project
newwp acme-redesign
# Quick test
newwp test-$(date +%Y%m%d)
# Plugin development sandbox
newwp gravityforms-testThe script runs through these phases — each one prints a colored status header:
==> Setting up site directory
✓ Created ~/Herd/mysite
==> Downloading WordPress
✓ WordPress core downloaded
==> Configuring database
✓ Database wp_mysite created
==> Tuning wp-config.php
✓ Fresh salts + debug + revision limit set
==> Installing WordPress
✓ WordPress installed
==> Cleaning default content
✓ Removed default plugins
✓ Removed inactive themes
==> Setting site preferences
✓ Timezone, comments, and permalinks configured
==> Securing site with HTTPS
✓ HTTPS enabled via Herd
==> Installing custom plugins
✓ Custom plugins extracted
✓ All plugins updated and activated
✓ Site ready: https://mysite.test
Open ~/Scripts/newwp.sh and look for the "Tuning wp-config.php" and "Setting site preferences" sections.
| Setting | Value |
|---|---|
| Timezone | America/Boise |
| Comments | Closed by default |
| Pingbacks | Closed by default |
| Permalink structure | /%postname%/ |
WP_DEBUG |
true |
WP_DEBUG_LOG |
true |
WP_POST_REVISIONS |
5 |
| Salts | Freshly randomized |
Just edit the relevant wp option update or wp config set line. For example, to change the timezone:
wp option update timezone_string "America/New_York"Here are useful WP-CLI commands you could fold in to extend the script:
Scaffold the standard pages every site needs:
wp post create --post_type=page --post_title='About' --post_status=publish
wp post create --post_type=page --post_title='Contact' --post_status=publish
wp post create --post_type=page --post_title='Privacy' --post_status=publishSkip the zip dance entirely for any plugin on the WordPress.org repository:
wp plugin install advanced-custom-fields wordpress-seo wp-mail-smtp --activatewp theme install astra --activateFor development sites where you want some posts to play with:
wp post generate --count=20
wp comment generate --count=50wp menu create "Main Menu"
wp menu item add-post main-menu $(wp post list --post_type=page --field=ID | head -1)
wp menu location assign main-menu primarywp config set DISALLOW_FILE_EDIT true --raw
wp config set DISALLOW_FILE_MODS true --rawwp config set AUTOMATIC_UPDATER_DISABLED true --rawRequires the doctor command package:
wp package install wp-cli/doctor-command:@stable
wp doctor check --allFor external services that need to push to your site:
wp user application-password create "$WP_ADMIN_USER" "Local Dev"wp option update blogdescription "A site built with newwp.sh"wp language core install en_GB --activateYou haven't created the credentials file yet — see Installation step 2.
The script refuses to overwrite existing sites. Either pick a new name or uninstall the old site first.
- Verify MySQL is running:
brew services listor check Herd's UI - Verify
DB_USERandDB_PASSin~/.config/newwp.envmatch your actual MySQL credentials - Test manually:
mysql -u root -p
Install WP-CLI:
brew install wp-cliInstall Herd from herd.laravel.com and make sure it's running.
Herd's HTTPS certs need to be trusted. Run:
herd trust- Verify
~/Scripts/zips/exists and contains.zipfiles - Plugins downloaded from WordPress.org sometimes come wrapped in a parent folder — the script handles
__MACOSX/cleanup automatically
There's no built-in uninstaller, but it's a three-step manual process:
# 1. Drop the database
wp db drop --yes --path=~/Herd/mysite
# 2. Remove the site directory
rm -rf ~/Herd/mysite
# 3. Remove the Herd HTTPS cert (optional)
herd unsecure mysite
⚠️ This is destructive and irreversible. Double-check the site name before running.
Author: Adam Lea License: Personal use