Is it better to use MacPorts or just use an Ubuntu VM for local tools/services when developing on a Mac?
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.
I've used both approaches in different circumstances. While MacPorts is a good way to get latest versions of various GNU tools (for instance Bash 4.x, when Apple still provides 3.x) it does tend to get bungled with time, I wouldn't rely on it exclusively.
However, most open-source stacks provide easy to use binary installers for Mac. I have good experience with distributions of Git, PostgreSQL and Apache. I have good experience using them for web-based development. Python scripts generally run unmodified - I've developed a web application in Python + PostgreSQL on my Macbook and simply ran it unmodified on the Linux production machine. Same for various scripts at work which wrap ssh credentials management inside Python classes etc. - Ssh is sufficiently uniform.
I do need to run Ubuntu VMs for some purposes. I mostly do that on VMWare servers because my work Macbook Air is poorly suited for large compilations and data transfers. However I've been able to export them from VMWare as OVF and import them to VirtualBox on the Mac. An Ubuntu VM without an X server running on Mac can be very lightweight with less than 10GB disk space and 1GB RAM. My solution for I/O intensive workloads is to create a separate partition on the Mac (completely hassle-free, no reboot required) and assign it to the Ubunbu VM as raw disk, then partition it using Linux fdisk and mount the partitions as necessary.
Some tool recommendations for Mac:
- SourceTree as a Git GUI.
- iTerm2 as a terminal emulator
- Textwrangler as a small and slick text editor that is readily invoked from the command line.
- Xquarz, the X server for Mac, is no longer bundled with OS/X 10.8, simply install it separately.