Skip to content

Instantly share code, notes, and snippets.

@cabgfx
Created December 10, 2012 15:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cabgfx/4251089 to your computer and use it in GitHub Desktop.
Save cabgfx/4251089 to your computer and use it in GitHub Desktop.
wpsetup
#!/bin/sh
#
# Instructions:
#
# First, create the directory where you want to install WordPress.
#
# Then, `cd` into this newly created directory
#
# `wpsetup` and watch magic unfold before you.
# Exit if we're not on OS X
if [ "$(uname -s)" != "Darwin" ]; then
echo "Sorry, you need Mac OS X to run this." >&2
exit 1
fi
echo "*** Installing WordPress..."
# Get latest, stable WordPress package
curl -o wordpress.zip http://wordpress.org/latest.zip
# Unzip the package and clean up files we don't need, including OSX-related cruft
unzip wordpress.zip
mv wordpress/* .
rm -rf __MACOSX
rm -rf wordpress/
rm wordpress.zip
rm wp-config-sample.php
# Now, setup WP with a sane development environment
# First, get the latest package, and clean up when done
curl https://github.com/cabgfx/wordpress_config/zipball/master -L -o master.zip
unzip master.zip
rm master.zip
mv cabgfx-wordpress_config*/* cabgfx-wordpress_config*/.[^.]* .
rm -rf cabgfx-wordpress_config*/
# Get salted keys for WordPress backend, fresh from the source
curl https://api.wordpress.org/secret-key/1.1/salt/ -o salt &&
sed -i '' -e "/define('DB_COLLATE/r salt" wp-config.php
rm salt
# Done. Now install your theme, etc. and enjoy local WordPress development without pains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment