Unix Tools on Your Desktop – Not Just For Mac Users
One of the main reasons I switched to Mac was for the underlying Unix-like kernel and command line. I’ve always had a local Linux server for development, and the ability to roll this functionality into my desktop machine was a great selling point.
As it turns out, while I love Mac OS, I don’t use it as my development server environment – I use a solution which would have worked just as well on a Windows machine.
If you haven’t come across it yet, virtualization software such as VMware and Parallels allows you to create virtual machines within your existing computer, onto which you can install just about any operating system, and run it as an application on your existing OS. From the perspective of the “guest OS” running on the virtual machine, it appears to be running on its very own hardware, and has no access to the “host OS”, except through specially set up sharing tools.
Lucas, our system and network administrator, recently wrote about using virtualization to set up multiple development and staging environments on a spare machine, which is something that saves us a lot of electricity, rack space and money at the office.
Virtualization can also be used to get the best of both worlds out of your desktop machine – the ease of a nice refined GUI, and access to a powerful server-centric operating system.
Mac or Windows – Even Linux
If you’re running Windows or Linux, VMware is the market leader for virtualization, and provide VMware Server for free. A free beta of VMware Fusion for Mac is available, but the final version will not be free.
Parallels Desktop is currently the only non-beta solution for Mac OS, and it has a very strong following. Parallels also offers virtualization software for Windows and Linux.
The software from both vendors is very similar in interface and functionality – both are easy to get up and running. You create a new virtual machine, specify how much disk space, RAM etc you want to allocate, and then install your guest OS from a CD, DVD or ISO image file.
If you’re thinking this would be a great way to get Mac OS running on your PC – well, you’re right. But unfortunately the Mac OS licence does not permit this, and so none of the virtualization platforms support it.
The Trouble With Mac OS
Running a custom development environment on Mac OS is nice in theory, but it can get quite fiddly. Compiling from source works fine 95% of the time, but the other 5% can cost you hours chasing issues with linker issues, OpenSSL conflicts and the likes.
There are package managers like MacPorts and Fink, but they can’t compete with their Linux competitors. As an extreme example, “fink install kcachegrind” triggered about 2 days of automatic downloading and compling of KCachegrind and all its dependencies – including the entire KDE! In contrast, I had the application running within a few seconds of typing “aptitude install kcachegrind” in Ubuntu.
The Trouble With Windows
While cygwin will let you run many ported Unix-like applications under Windows, and many applications such as Apache, MySQL and PHP have Windows versions, Windows just doesn’t offer the standard environment and tools to run a serious development environment to satisfy a command line junky. It’s getting better, but it’s not there.
A Linux Virtual Server
I’m a recent Ubuntu convert, after many years running the slightly aging Slackware Linux distribution. If you’re fairly new to Linux, I’d recomment installing Ubuntu Desktop on a virtual machine for starters. This will give you a nice intuitive GUI while you get the hang of things. I went with Ubuntu Server, which provides no GUI. I run it in the background, accessing it over SSH using iTerm (or PuTTY on Windows) rather than the more clunky VM window.
Ubuntu provides a huge amount of up to date software in their online repository, which can be easily installed using the graphical Synaptic Package Manager, or “aptitude” from the command line. For example, “sudo aptitude install subversion” will sort you out for source code management in a matter of seconds, and “sudo aptitude install rails” will predict your next web application and write it for you! (sorry – I couldn’t resist)
Out of the countless useful applications available, Samba (‘sudo aptitude install samba’) is probably the one most worthy of mention. It provides a file sharing compatible with Mac OS and Windows, so you can connect to your virtual machine as a network drive, and edit the files in place, with your changes just a save and browser refresh away. No more FTP transfer to see every change.
Just two quick warnings. Firstly, there’s an issue that exists between Parallels (up to the current build 3188) and the Linux kernels used by Ubuntu 7 (codename Feisty Fawn) and other recent Linux distributions. While there’s some work-arounds, I’d go with VMware Fusion Beta if you want to run the latest Ubuntu on Mac, until Parallels releases an update. Secondly, running a virtual machine will increase your power consumption a little. While still far more efficient then running two physical machines, you’ll certainly notice the difference on your battery life if you have a laptop. However a Linux VM with 256mb RAM only takes a couple of seconds to suspend and resume, so this hasn’t bothered me much.