webtimeless
Terminal tool

A local WordPress site in one command.

devmagic makes the certificate, the Apache SSL vhost, the hosts line, the database and the WordPress install for a local domain, and can import a dump and clone your repos into it. A wizard asks the questions when you would rather not remember the flags.

curl -fsSL https://webtimeless.cloud/devmagic-cli.sh | bash

Downloads the newest release, checks it against its checksum and runs its install.sh, which asks for sudo when it needs it. Run it as your own user.

MIT licenseVersion 1.1.0Ubuntu and Debian
What it does

devmagic CLI at a glance.

A local WordPress site from one command: certificate, Apache config, hosts line, database and WordPress.

Certificates from a local CA

Make a local certificate authority once with -ci, then a certificate for each site with -c.

Apache and hosts

-cf writes and enables the site's SSL vhost and adds its domain to /etc/hosts.

WordPress and its database

-w creates the database and installs WordPress; -dbf imports an existing dump into it.

Your code in place

-cr clones the main repo into the site folder, and -pr clones more, like a theme and a plugin, where each belongs.

Wizards for setup and cleanup

--wizard asks for everything step by step, and --remove-wizard removes a site with its database, vhost and certificate.

The wizard

Rather not remember flags? It asks.

devmagic --wizard walks through a site question by question. This is it, its own words, with made-up answers.

devmagic --wizard
$ devmagic --wizard
############################################################
# Welcome to the Dev Magic Wizard 🪄 #
############################################################
We will ask you a few questions to can create
a magical environment for your local development.
Enter domain (local.example.com): spellbook.test
The domain name spellbook.test doesn't have the prefix 'local' Do you want to add it? (y/n): y
Would you like to create an SSL Certificate? (y/n): y
Would you like to create an Apache config file? (y/n): y
Would you like to clone a project repository into the domain folder? (y/n): y
Enter the Git repository URL for the project: git@github.com:spellbook/site.git
Would you like to clone additional Git repositories? (y/n): n
WordPress setup will be performed with the cloned project repository.
Enter dbname: spellbook
Enter dbuser or leave empty for the default value (root):
Enter dbpass or leave empty for the default value (…): a-local-secret
Enter dbprefix or leave empty for the default value (wp_):
Would you like to import DB from a .sql file? (y/n): y
Enter dbfile (path to the .sql file): ~/dumps/spellbook.sql
Would you like to add a new user after DB import? (y/n): n
[SUCCESS] The SSL config file for local.spellbook.test has been created and enabled successfully!
[SUCCESS] Added local.spellbook.test to /etc/hosts
Examples

Commands to start from.

A complete site

devmagic -d local.spellbook.test -c -cf -w -dbn spellbook -t Spellbook

From a dump, with a theme repo

devmagic -d local.shop.test -c -cf -w -dbn shop -dbf ~/dumps/shop.sql -pr 'git@github.com:spellbook/theme.git{to}/var/www/local.shop.test/wp-content/themes'

The guided way

devmagic --wizard

Remove a site

devmagic -d local.spellbook.test --remove
Requirements

What it needs

Ubuntu or Debian with Bash 4 or newer.

  • Apache with mod_ssl and mod_rewrite
  • MySQL or MariaDB
  • PHP 7.4 or newer, with php-mysql
  • curl, git and OpenSSL
  • Recommended: WP-CLI and Composer
Questions

Good to know

Does it work with devmagic-panel?

Yes. The panel lists the sites devmagic makes, keeps their vhosts as they are, and can reissue their certificates and manage their hosts lines.

When do I need -ci?

Once per machine. It makes the local certificate authority that signs your sites' certificates and adds it to the system's trusted store. Firefox keeps its own list, so import it there once by hand.

Which domains should I use?

Names that never exist on the internet, like local.spellbook.test or shop.localhost. The command builder on this site takes the same local names as devmagic-panel.

Type to search the docs, guides, comparisons and tool pages.