How best to isolate my development environment on OS X?

What is the current best practice for setting up a development environment on OS X?

I recently got a new Mac with OS X 10.10, Yosemite.

I'm familiar with homebrew, and from my Linux experience, also with VirtualBox and using (headless) VMs. However, I know virtually (pun intended) nothing about Docker.

I'm a developer and have recently begun learning Node.js and Meteor. I have worked in the past mostly with Python on Linux machines. However, since 2013 I've had a self-imposed break from daily development while I've returned to school to earn a new degree.

A lot has changed since I left full-time development work in 2013 (I should have done a better job of staying on top of things). Now there's Docker, I'm hearing about Ansible for the first time, Homebrew is still around, no one seems to be using MacPorts anymore, and I feel completely lost with regard to figuring out the optimal way to setup my new machine for Node, Python, and C/C++ development.

My primary concern, aside from being free to play with and develop apps in Node, Python, and C/C++, is that my development environment must not interfere with my OS and daily computing life at all. For instance, when I got my first Mac back in 2009, I used homebrew to install Python and several packages, and at some point my system got somewhat screwed up with all the cruft I put on it.

I definitely want to avoid that. If that means using a VM or container (I'm not sure what the difference is, btw) to do all my development in, so be it, no matter how inconvenient it is. I'd rather keep my OS X system clean.

On the other hand, if there is a way to develop directly on my OS X machine, while keeping it clean and without allowing any software I install to interfere with my "normal" day-to-day apps and usage, that would be nice.

Can anyone offer any suggestions/advice? I have googled several variations of the query "os x development environment [language]" and have used search tools to filter out all but recent entries, but I haven't found an article on the subject yet that I am confident in.


Solution 1:

There will be no correct answer to your question. Much relies on your preferences and development needs.

Developers working on Mac or iOS software are expected, by Apple, to do so without using a virtual machine.

If you are deploying to Linux or a non-Mac platform, a virtual machine is probably recommended.

To test your software on other versions of OS X, a virtual machine can be helpful.

Compiled Languages

To develop with C, C++, Objective-C, and Swift use Xcode. Xcode is Apple's own development tool and it will not harm your installation of OS X.

Scripts and Dynamic Languages

To develop with python or another scripting language, consider using a tool that allows installation of multiple versions of your language.

  • For python investigate virtualenv; see Multiple Python Versions on OSX with Virtualenv and Homebrew;
  • For perl this would be perlbrew.

The aim is to install and use a version of your language that is isolated from the OS X provided binaries. Updates may change the OS X provided edition, but your environment will remain unchanged.

Homebrew and MacPorts

You should be able to use both homebrew and MacPorts without risk to your installation of OS X. Both package managers try to isolate their installations and both simplify removal of unwanted or troublesome software.

If you encounter problems, please log bugs with the developers.

As of 2015, both package managers are being actively developed:

  • You can follow homebrew's development on Github;
  • You can see recent changes to MacPorts in their timeline.