Plenty of posts have been written about setting up a local development environment for WordPress, but when I moved to a new Macbook (running OS X Yosemite) I couldn’t find a post that contained all the instructions I needed. After some searching I got everything up and running and thought it would be worthwhile to share my process and tools here for posterity.
I use my local development environment for:
- WordPress plugin development
- Working on WooThemes products (plugins & themes)
- WordPress core contributions
- Working on client sites
For this I use the following tools:
- Vagrant for the general development environment
- SVN for checking out WordPress trunk and managing my plugins on the WordPress.org repo
- Git for managing my public plugin repositories as well as all of the WooThemes product repositories
- Sublime Text for editing code
The initial setup of the Vagrant environment was easy usingVarying Vagrant Vagrants. They have a complete step-by-step on their GitHub repo, so you shouldn’t struggle getting that up and running. It did take quite a while to set up, but that’s only because it has to download a lot of software in order to work – it’s relatively uncomplicated to get it working though.
VVV comes with some handy features for WordPress development, most notably it includes the WordPress trunk repository checked out from SVN. This enables you to get the latest development version and create patches to submit to Core Trac easily.
One thing that VVV doesn’t include by default is the ability to easily generate new WordPress sites on the fly. If you’re developing sites for clients, or if you often require new sites for testing, then this is pretty much essential. Luckily, there’s a VVV add-on script that handles this for you very easily:Variable VVV by Brad Parbs. The wizard is a single script that is super easy to use and will generate new sites for you with no additional work on your part – simply follow the simple guide in the GitHub repo and you’ll have no problems.
There’s no need to install SVN before setting up VVV, but in order to use the WordPress trunk SVN repo you need to upgrade the default SVN version. If you’re not sure how to do that, then this guide will run you through the (very quick) process.
If you aren’t comfortable using SVN in the command line then I recommend using Versions to manage your SVN repos through a robust GUI.
You don’t need to install anything extra to manage your Git repos, but if you would rather not use the command line to manage things then SourceTree is your best bet for a functional GUI for managing both GitHub and Bitbucket repos.
The code editor you use is entirely based on your own preferences, but I like to use Sublime Text 3 for development. The main reason for this is the plethora of add-ons that are available for it – some of which are hugely helpful for WordPress development.
Before you can install add-ons for Sublime Text, you need to enable Package Control. Once you’ve done that you can install any of the available add-ons. These are the ones that I use:
- Alignment – Easy alignment of multiple selections and multi-line selections
- Bracket Highlighter – Bracket and tag highlighterto help you navigate your code more easily
- Gist – Allows you to create new Gists from selected text
- LESS – LESS syntax highlighting
- Sass – Sass syntax highlighting
- SCSS – SCSS syntax highlighting
- SidebarEnhancements – Adds some useful additional features to the files and folders sidebar
- SublimeLinter – Interactive code linting framework
- SublimePhpTidy – Format PHP code to meet the WordPress Coding Standards (install instructions for Sublime Text 3)
- TrailingSpaces – Highlight trailing spaces and delete them in a flash – very useful for cleaning up messy code
- WordPress Developer Resources – Easily search the new WordPress Developer Resources right from your code
- WordPress Readme to Markdown – Easily convert your plugin’s readme.txt file to markdown for use on GitHub
The colour scheme I use these days is the Material Colour Scheme – based on Google’s Material Design UI. It provides a dark background with bright colours – kind of like the popular Monokai, but brighter.
That’s my setup – what do you use?