Mac – Is it better to use MacPorts or just use an Ubuntu VM for local tools/services when developing on a Mac

developmentmacportsvirtualizationvmware

As a developer (primarily JVM-based web apps), I need to use a lot of different tools and services, such as Redis, RabbitMQ, MySQL, git, mercurial, etc. Having worked in a Linux environment where such tools are just an apt-get away, and a Windows world where I just run what I need in a VMWare Workstation VM (aka. also just an apt-get away + vm overhead), I'm a bit lost now that I'm hoping to move away from Windows and into the Mac ecosystem for my computing life.

I've read about MacPorts vs. Fink vs. Homebrew and found it all to be a bit confusing as to which one will suit my needs the best, though I think MacPorts is the most flexible option of the three.

Since I'm used to running what I need in a VM, however, is there anything against doing that when using OS X? What are the tradeoffs between going with MacPorts to install things directly vs. using an Ubuntu VM (via VMWare Fusion) to host the tools / services I need?

In particular, I am concerned with the disk usage, maintainability, and ease of use more than I am concerned with performance. In other words, this is what I care about (in order of preference):

  1. Ease of use – How easy is it to develop on the Mac and use the tools / services
  2. Disk usage – How much disk-space is taken up. The newer macbooks use SSDs and space is at a premium.
  3. Maintainability – What work is involved in keeping packages updated, adding new packages, and removing old ones
  4. Currentness – How up-to-date are the tools / services that are available
  5. Performance – How fast things run, services in particular

My instinct says that installing the actual development tools, like Mercurial, git, etc. directly via the projects' recommended method, and then installing the server-side components like MySQL, Redis, RabbitMQ, etc. into a VM is the best route, but what are the pros-cons of doing this vs. going with something like MacPorts?

Note: I realize that this is a rather programming-centric question, but the central issue is that OS X is different from Windows and *nix when it comes to setting up a development environment and I'm not sure how to navigate in these OS X-specific waters.

Best Answer

Ultimately this is a fairly personal question, that will depend a lot on your workflow and preferences, but I'll add what I can.

My instinct is in line with yours—install the tools you need for writing your code natively, and use a VM for your server-side environment. My reasoning on this is that you (presumably) bought a Mac to use it, and doing most of your development work in a Linux VM seems like a bit of a waste. Use the native tools so that you can use them with whatever other OS X software you may want.

Similarly, while you could probably do a decent job of mimicking your deployment environment in OS X, using a VM is the best way to guarantee exact compatibility (it also makes it easier to manage different versions of your various programs, if you need to work with a production environment and a future server upgrade, etc.).

Ease of Use

I think the OS X tools + testing VM approach wins, as having all your development tools accessible without the need for a VM is the most frictionless, and the testing VM can act independently. OS X is BSD at the core, and as such there's great integration with the command line, particularly in developer-type tools like text editors.

Disk Space

VMs will obviously take up more room than just installing the tools natively, but Ubuntu seems to be able to run in a pretty small footprint (the CLI-only install on my home server runs around 3-4 GB I think, and that could probably be pared down if I tried). So unless you're really cramped for space, I wouldn't worry too much unless you need many different VMs.

Maintainability

I think you'll definitely want to go with a package manager, whether it's MacPorts or one of the other options. I'm not experienced with any of them, but I know MacPorts (and probably Homebrew and the others) have one line update commands, similar to apt.

Currentness

This depends a lot on how you choose to install your software, and what software you're using. Apple tends not to update the CLI tools it bundles very often (often only with major OS releases), so if you rely on a particular version of something that's otherwise built in, you may want to install a newer version (which you should do by installing to a new location, not overwriting the system version). My best advice here is to do some Googling and figure out how current the packages that are important to you are in each package manager.

Performance

VM performance on any recent Mac should be pretty good, but it obviously depends on how intensive the tasks running on the guest OS are. Unless your server side component is pretty heavy (and I don't see why it would be under a development testing load), you should see pretty good performance, particularly if your VM doesn't run a GUI.

Anyway, that's my take, perhaps others can chime in with more specific opinions on Macports vs. other options, or other takes on VM vs. native.