Two recent articles here on SitePoint talked about how people set up their development environments. Zack Wallace talked about setting up a Windows development environment, and Shaumik Daityari talked about his experience working with Ubuntu Linux.
In this article, I want to talk about how I set up a development environment on Mac OS X. But first, a little bit of background.
I’m a freelance software developer and technical writer. Given that, I need a wide variety of tools on a regular basis, whether they’re for software development, research, writing or experimentation.
It definitely is demanding having to cover everything from managing code, accessing remote servers and managing databases to writing and reviewing content. However, the great thing about the Mac is that there are so many tools available for it.
The Basic Tools
New Macs come with the iWork suite, Safari, Preview and The Unarchiver, amongst a range of other GUI tools. On the command line, they come with various open source tools, such as SSH, Wget, and cURL. However, these alone aren’t enough. To do proper web development, and technical writing, we need a number of others. Specifically, I regularly use a combination of the following:
- Dropbox and Google Drive
- Firefox, Google Chrome and Chromium
- Pixelmator and Skitch
- Colloquy, Skype and Slack
- Evernote and Wunderlist.
These tools are pretty much indispensable on a day-to-day basis.
Dropbox and Google Drive allow me to share files with clients. I could use the in-browser versions, but installing the apps makes syncing even simpler.
And no web development environment would be complete without all of the modern browsers. As Internet Explorer isn’t supported on the Mac, like Zack, I use a range of tools – such as BrowserStack – for testing sites in IE.
Pixelmator and Skitch make it simple to edit and make annotations to images. Pixelmator isn’t free, but isn’t that expensive either. You could use GIMP instead, but I find its interface leaves a lot to be desired.
For making and storing notes, I use Evernote. It’s definitely got that space nailed. And all I need for project management is Wunderlist. With it, I can stay on top of all the work I have to do for each client, as well as keep notes about conversations we’ve had and what I still have to do.
But now let’s get in to the more serious stuff: editing. I do two types of editing – content and code – so my discussion of editors will reflect that. Regardless of which one you’re doing, there are several very good editors available for the Mac.
When I write, I write in Markdown format. It lets you write structured content in any text editor, without the need for special software (such as Microsoft Word) which can leave you at the behest of one vendor or another. Using tools such as Pandoc, you can export your content to nearly any other file format.
For writing in Markdown, there are several great native apps available, including MacDown, iA Writer and Writer Pro and Mou. Heck, you could even use TextEdit, though it’s not really well suited to the task. In addition, there are various online Markdown editors, including Gingko, Draft and Bruno Škvorc’s favorite, StackEdit.
I’ve tried and can vouch for all of these, though I don’t use them on a regular basis. For me, the best tool to use is Vim, ideally MacVim. It does take a little bit longer to set up and configure. But once done, it’s amazing. What’s more – it’s free. If you’re keen, or struggling, checkout my Vim configuration repository on GitHub.
Next there’s code. The Mac has a number of code editors available, irrespective of whether you’re a PHP, Python, Ruby, Go, Haskell or C++ developer.
There’s the ever present, excellent quality Sublime Text 3, which I’ve used often and happily attest to. There’s also TextMate 3, which is light, simple and extensible. But for me, my go-to editor of choice is PhpStorm. Based on IntelliJ, it just does so much; and what it doesn’t do natively, there’s likely a plugin for. Having said that, it’s not free. But the price really isn’t that much, especially when you weigh up the benefits.
Next, let’s look at version control. Whether I’m writing or coding, I always use version control. And my version control system of choice is Git. To me, that’s a no-brainer. However, you may be equally as comfortable using Mercurial. If you’re using Subversion, OK. But I can’t honestly support CVS.
Using Git as my frame of reference, there are several good tools for Mac to choose from. Firstly, there’s the more simplistic GitX. Open-source and free, and a Mac clone of Linus Torvolds’ GitK, it provides the key functionality required to manage a Git repository and provides a nice built-in diff viewer.
Then there’s the powerhouse SourceTree. If you’re looking for one app that does it all, one actively developed by a large corporate focused on developer tools, Atlassian, then don’t go past SourceTree. I used it for ages (before I committed to Git from the command line) and it’s excellent.
I’ll also give an honorable mention to SmartGit as well.
Of these three, the one that I’ve used the most, and highly recommend, is SourceTree. However, as with MacVim being my text editor of choice, I manage my Git repositories from the command line. (I’m not going to suggest that you should use the command line too. But I will say that it’s worth the investment of time to learn how to use it, as it does help you become a lot more productive. That being said, if you’re not a command line person, SourceTree is the way to go!)
For servers, I take one of two options. I either use built-in servers, such as those with Ruby and PHP, and run without the overhead of much additional software, or I run up a virtual machine. I’ve used VirtualBox and Ubuntu Linux for this, but increasingly I create my own using Ansible and Vagrant.
There’s a whole series of tools that you can call on, and by default there are lots of language libraries and extensions that don’t come with binaries installed on the Mac, and even the versions that are installed may not be new enough. To get around this, I use Homebrew, one of two excellent package managers for the Mac.
Homebrew works similarly to APT and yum on Linux, in that you can search a package repository and install, upgrade, and configure packages using it. For a good understanding of how it works and what it offers, check out Homebrew’s online documentation.
For database work, I mostly use MySQL. I guess you could put that down to my PHP heritage. But I also regularly work with both PostgreSQL and SQLite as well. To install any of these databases, you can download them from their respective vendors, via the links.
Whilst I’d like to think of myself as a hardcore command line guru, I’m not when it comes to databases. For that I’ve been using Navicat Lite for some years. It’s an excellent tool that provides uniform access to a wide number of databases.
Navicat not only supports MySQL, PostreSQL and SQLite, but also Oracle and SQLServer. It allows for painless creation of any schema element, creating and running queries by hand, searching, creating and updating records – everything you’d expect from a database management tool.
For outside access, I regularly use the SSH library of tools, whether that’s SSH-ing to a remote server, or copying files to or from my development environment. In addition to that, I also regularly use cURL and Wget for grabbing files and for running requests against APIs and performing website interaction.
But if you’re not so command line inclined, there are some really good GUI tools. There’s the venerable FileZilla, as well as the more slick looking Cyberduck and Transmit. Each of these three tools will allow you to manage files remotely with just your mouse.
Wrapping It Up
And that’s how I get my environment set up with all the tools I need. I admit that I do use the command line and command line-type tools quite heavily. But I’ve also covered a number of GUI tools that you can use in their place as well, if that’s your preferred style.
Despite the derisive comments people often make about the Mac, be in no doubt – there is an abundance of software available for it. And because of its BSD heritage, it has access to the open source and Posix-compliant tools as well. So no matter which way you go, you have a wide array of tools at your disposal when working and developing on the Mac.
So, how does my setup compare with yours?
Matthew Setter is a software developer, specialising in reliable, tested, and secure PHP code. He’s also the author of Mezzio Essentials (https://mezzioessentials.com) a comprehensive introduction to developing applications with PHP's Mezzio Framework.