Skip to content

Instantly share code, notes, and snippets.

@scottlee
Created July 28, 2011 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottlee/1112445 to your computer and use it in GitHub Desktop.
Save scottlee/1112445 to your computer and use it in GitHub Desktop.
Here's my little local development only script I use to download and install WordPress. mac, osx, mamp
#!/bin/bash
##########
## Setup: hardcode your mysql user/pass. Yeah, yeah, I know...it's frowned upon.
## but for local development, I have no problem with it.
## Find and replace: MYSQLUSER / MYSQLPASS
##
## Usage: This script accepts only one variable, the site name.
##
#########
# Create working folder
mkdir /tmp/getWP
cd /tmp/getWP
## Download latest (stable) version of WordPress
curl -O http://wordpress.org/latest.tar.gz
## Uncompress
tar -xf latest.tar.gz
cd /tmp/getWP/wordpress/
## Edit wp-config
mv wp-config-sample.php wp-config.php
sed -i .bak "s/username_here/MYSQLUSER/g" wp-config.php
sed -i .bak "s/password_here/MYSQLPASS/g" wp-config.php
sed -i .bak "s/database_name_here/$1/g" wp-config.php
## Create Database
CMD="create database $1"
/Applications/MAMP/Library/bin/mysql --host=localhost -uMYSQLUSER -pMYSQLPASS -e "$CMD"
## Move working folder to ~/Sites
mv /tmp/getWP/wordpress ~/Sites/$1
## Open in Firefox
open -a Firefox http://local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment