I'm a frequent reinstaller. There I said it. I can get a lot of entertainment by setting up my computer just the way I want it to be. This means that after a few tries i've got this thing covered and it is time to share it with the world. For the record, I'm not going into the process of obtaining and installing OSX, you need an Apple Developer account for that, and if you do have one, you know how to install it.
IMPORTANT: This guide is quite old, please use the updated version: Setting up my perfect developer environment on OSX 10.8 Mountain Lion (10.8.2 final edition)
So, you have go a clean install, now what.
First off, head over to the Apple Developer site and download “Xcode 4.4 Developer Preview 3 for Mountain Lion” and install it. Now, open it up the Xcode preferences, go to 'Downloads' and install the command line tools. This installs stuff like GIT, GCC, etc

We also need to configure some System Preferences. To make the sidebars more pretty, go to General and set the Sidebar Icon Size to small.

In the Dock settings, decrease the size, minimize into the application icon and disable the animation for opening and closing applications.

In Security & Privacy allow running applications from Anywhere. In the future this probalby won't be needed, yet at this point a lot of apps have not been updated. I also disable Location services, because it keeps running at 100% cpu.

Terminal
As a developer, a lot of time is spent in the terminal. There are a lot of customisations possible that make working here better. Mathias Bynens made a great repository with a whole host of settings on Github. Clone it, read it, fork it and make it your own. So did I and the result you can find on Github as well. I removed some of the settings that did not agree with me, but added others that are needed in my workflow or to work around issues.
To install my version run
|
Important: Edit the .extra file with your own information and then run
|
Restart your terminal and be amazed.

Another gem in this dotfiles repo is the .osx file. It's full of settings that improve OSX for the developer. More info via Lifehacker. Just run:
|
In a lot of guides you will find a section telling you to install iTerm2, since i have never found anything lacking from the native Terminal.app, i just use the default. There is only one thing that is missing, and that is a global hotkey to open the Terminal.
That's a job for Alfred. Using the Powerpack extension you can add global hotkeys. Add Terminal.app like so:

Homebrew
To install all kinds of open-source applications like database servers etcetera, we need a decent package manager. The best one for OSX is Homebrew. Install it by running:
|
Mountain Lion removed X11 from the installation, you need to install the version from XQuartz
Now, let's install a package. Important to note that all these commands are executed as your own user!
|
bash-completion will help you along with completing commands, link git, or homebrew commands. Always read the notices after installing a package from Homebrew, since extra installation steps are described there. For example for Homebrew:
|
Now the first one is included in my dotfiles, the last was you still need to execute.
I always install GIT from Homebrew to get the latest and greatest. Don't worry more packages will follow.
Text editor
Next up, we need a text editor with some punch, depending on your taste ofcourse. I like Sublime Text 2, download, install and enter your registration info. We will set this up following parts of Stuart Herberts guide for Sublime Text 2 and PHP
You first need to install Will Bond’s Package Control (installation instructions). Package Control is a plugin that automates the job of installing and upgrading plugins. After you’ve installed it, restart ST2, and then you’ll find a new “Package Control” menu option at the bottom of the “Preferences” menu.
Using Package Control, install the ‘Soda’ Theme plugin and the Phix Color Scheme. Open up the ‘Settings – User’ preferences file (this is a JSON file), and add the following to tell ST2 to use the new theme:
|
Follow along with this video to do this:
If you are into PHP programming in a text editor and not in an IDE, follow the rest of his guide. I will move along to Trailing whitespaces. They are annoying but ST2 can remove them on save.
|
One step left, installing the commandline addon.
|
Ruby
I've got a love-hate relationship with Ruby. Lots of great tools are written in Ruby, yet it's a mess to install with all the different versions and gems. There are a few projects geared toward easing this, where I feel rbenv is the most suited.
rbenv lets you easily switch between multiple versions of Ruby. It’s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
Let's install it:
|
You can now install Ruby 1.9.3-p194 and setting it as default by running the following. Afterwards, test if it worked by opening a new Terminal window and running ruby -v
|

Databases
For my development I make use of mySQL, Postgresql. Let's start by installing mySQL from Homebrew
|
Now let's move on to Postgresql. Under 10.8 there is an error while compiling some module. If you compile using -dv you get a recovery console, by just typing exit, it will finish installing. Until now I have had no problems with the result, so the error is probably in some plugin that I do not use.
|
You need to create the database and set it to run by default by running
|
No plist file is created due to this compile error, but since I do not use postgres often I can make due with the alias that is created in the dotfiles.
|
PHP
The PHP installed in 10.8 is 5.3.10. Although I always want the latest and the greatest, I normally would have installed 5.4 from the php-osx project. I tried Homebrew and compiling by hand, too much hassle.
So, we will just have to work with the preinstalled version.
Let's start with install pear, apc and xdebug.
|
|
Now pecl install adds xdebug as extension, and it needs to be a zend_extension. Open /etc/php.ini and chenge the xdebug line at the top to
|
Now we need the intl extension for Symfony 2
|
Add the following to /etc/php.ini
|
And now the gettext extension
|
Add the following to /etc/php.ini
|
Change the php.ini to look like this
|
In php.ini, you need to replace all /var/mysql/mysql.sock by /tmp/mysql.sock so php can connect to our mySQL version.
The end
That's it, probably there will be some small updates in the following days, i'll keep you posted. If you have any suggestions or remarks, please let me know in the comments.