Photo of MacBook Air
A hipster photograph of my hipster Mac.

Until about a year ago, I did all my "real" work on Linux based desktop and laptop machines. I got my first MacBook Pro in early 2011, and about a year later started using it to do real development work instead of my Linux laptop. The reason? More available software (like Citrix GoToMeeting, which as much as I dislike it, many of my clients use it), design tools (looking at you Adobe), and I finally discovered all the development tools I would need to feel at home on OS X. I still am most productive, when it comes to development, working on my Ubuntu desktop machine in the office. But, even then, I often have a Mac sitting next to me.

So anyway, I thought I'd share my perspective, as a full stack web developer coming from Ubuntu, on how I set up an OS X machine for web development.

USB Boot Drive for OS X recovery

I know you can recover OS X from the web, but I like to have it stored on something locally so I don't need internet access to restore the machine. I wrote a blog post on creating a USB boot drive for OS X to have something to refer too.

Clean install of OS X

Next, I like to do a clean install of OS X, assuming the target machine is not right out of the box and wet behind the ears. Again, I wrote a blog post on doing a clean install of OS X for reference.

Web Browsers

I don't care much for Safari for my own personal use, and don't see much value in it as a professional web developer either (other than occasional testing). So, the first thing I do is use Safari to download Chrome and Firefox.

Dropbox

Next, I need to get my documents synced on the machine. I've finally gotten in the habbit of saving everything to Dropbox, other than my Git projects (see below). That way, all documents are up to date, on all devices, all the time.

I do avoid saving very large files (most videos and photo archives) to Dropbox because a) they take up a lot of space and b) they take too long to sync. If I really need to keep those files on multiple machines I put them in a special directory which I sync with my remote server using rsync (more on that in another post).

I download and install Dropbox as soon as I can, because the file sync process can take a while.

Get a Real Terminal

While I'm waiting for the Dropbox file sync process to finish, I take the time to get a few other essentials.

Developers spend a lot of time on the terminal, and the default terminal on a Mac sucks. From my experience the terminal with the most mind share in Mac world is iTerm2. You can easily download and install it from their home page.

Once I have it downloaded, I move the iTerm2.app package to the global /Applications/ directory on OS X. This is generally how OS X organizes user applications; .app packages stored inside the /Applications/ folder, which is something I really like about the platform.

I don't spend much time tweaking it out now, but that'll be a fun way to kill an afternoon later.

Editor

The next order of business, after having a good terminal, is getting a text editor. There are a lot of great options for a Mac, but I've always been a Vim user, so MacVim is the one for me.

MacVim can be downloaded from here.

After downloading the MacVim package, I unpack it, then move the MacVim.app folder into /Applications/, and the mvim script from the package folder into /usr/local/bin/, which I put on my PATH for Homebrew (see below).

Then I can start MacVim from the terminal with mvim.

Passwords

I use KeePassX, and store the password database (the .kdb file) on Dropbox. Since KeePassX is cross platform, as well as Dropbox, the combination of the two gives me a password management system that works on all my devices all the time. #FTW

Get Bootstrapped With Xcode and Homebrew

XCode is Apple's developer tools suite for OS X and iOS. It's not really possible to do much real work without XCode, since it contains the software compiler. The good news is that it is now possible to just get the Command Line Tools instead of the entire XCode bundle.

XCode Command Line Tools is really all most of us will ever need, and takes up a lot less space on the machine. However, I usually install the whole package because I like to have the iPhone and iPad emulators.

Homebrew is a third party package management system which is pretty much required to maintain all the tools you'll need for development on the Mac. For everyone familiar with Ubuntu, Homebrew is pretty much like apt-get. If you don't use Homebrew, and try to build all your development tools yourself, you're going to have to manage all of the dependencies yourself too. That's a colossal waste of time. Don't try it.

There is another package management tool for Mac called MacPorts but I think it's falling out of favor. So, I stick with Homebrew.

So, you can see on bottom of the Homebrew website that installing it is like falling off a log -- easy. However, take a look at the wiki and you'll see there's a little more to it. At a minimum Homebrew will need the Command Line Tools from Xcode.

If you have Xcode already then you'll need to enable the Command Line Tools. Open Xcode and go to Preferences > Downloads to install the tools.

If you want to install the Command Line Tools without XCode then go to developer.apple.com/downloads. You'll need to sign in using your Apple ID (the same one you use for iTunes purchases). Once there, use the search field to find "command line tools", expand the search result, and click on the .dmg file to download it. Once it's downloaded, double-click on it to mount the disk image and then double-click on the .mpkg file to go through the installation. You might need to change focus to Finder if the dialog gets buried under another window.

Right. So, when you've got Xcode command line tools installed then just follow those instructions on the Homebrew website to install Homebrew.

Since Homebrew installs all your software in /usr/local/, you're going to want to put /usr/local/bin on your PATH so you can run programs without typing the whole path. For example, use git instead of /usr/local/bin/git. To do that, I add this snippet to the bottom of my ~/.profile file:

# Customize the PATH (especially for Homebrew)
if [ -d /usr/local/bin ]; then
        PATH=/usr/local/bin:$PATH
fi

You'll need to restart your Terminal (or run source ~/.profile) to activate the PATH.

Install Git

With Homebrew installed, the next step is to install Git. I'm not going to waste electrons explaining why that is important at this point. Git may already be on your Mac, but if you run git --version you'll see that it is an older version of it.

We can easily get a newer and shinier Git using Homebrew. While I'm at it, I also install bash completion, which allows you to use the TAB key to autocomplete commands with git (and some other programs too).

brew install git bash-completion

Now run git --version (assuming you have added /usr/local/bin to your path, like above) and you should see that you have a much newer version of it now. To get bash-completion working, you'll need to restart your terminal.

Web Development Environment

With Homebrew and Git ready to go, I can put together my development environment. Like I mentioned above, I save all my documents to Dropbox, except my Git based projects, which includes just about everything I'm working on, as well as some repos just for reference.

I could clone and pull these repos one at a time, as needed, but I'm a computer programmer, and AUTOMATE ALL THINGS. So, I have a Python script I use to read a list of all the repositories I'm interested in and clone them to ~/Rprojects/ (Remote Projects) and ~/Rprojects/Reference/.

I also install the latest Node.js since I use that a lot. But other than that, I like to keep my development environments on virtual machines so I don't mess them up. VMs allow me to build a machine, screw it up, and start over again without putting my laptop out of commission.

However, if you're a heavy Ruby and/or Rails developer, you might also want to install RVM and a basic Rails environment on your machine. For that I'll point you to another great post for installing XCode, Homebrew, Git, RVM, and Ruby on a Mac by Moncef Belyamani.

Adobe

As much as I hate to do it, I purchase and use Adobe's software for creating, editing, and managing web graphics. With Adobe Creative Cloud, which gives you access to everything in their Creative Suite on a subscription basis, it is a little easier to swallow than it used to be.

In particular, I have found Adobe Fireworks to be a much undervalued tool for creating interactive web mockups. This saves a lot of software design work in code, since many of the problems become appearent while working in Fireworks.

Enjoy!

I really do enjoy doing development work on a Mac. The hardware is rock solid and OS X has everything I need to get the job done. And, hopefully, as this post demonstrates, you don't have to be 100% tied to proprietary tools, but at least OS X gives you access to some important ones which are not possible to have on Linux.