Gnoshme Blog

Ruby on Rails (and other development environments) for Mac people who like Linux

Posted by keith about 483 days ago

How to have the best of both worlds, living as a Mac user, but have your entire dev environment in the linux distro you know and love.

So.. I'm a linux guy who got a Macbook Pro. What's not to like about that lovely piece of hardware? Serously. It's a piece of modern sculpture, but with it's arrival came a bunch of important decisions, because at the end of the day, I like Linux on the Desktop very very much indeed.

Initially the plan was to just dual boot with Ubuntu being my primary OS, booting OSX once in a while to update my iPhone and make the odd home movie. Unfortunately, I got my Macbook pro the very day that Facetime Beta for the Mac was released, and the idea of OSX started to appeal. You see, much of my love for Ubuntu is fueled from my utter hatred of that steaming pile of mucus that is often referred to as "Windows". My aversion to OSX to a great extent is more that I have lots of Linux boxes.. running desktops, media centers et all, so why learn something new? Oh.. and the cube of course, I really miss that cube ;-(

Anyhoo. So I started going down the path of building my rails environment on the Mac. By the third time I'd thrown up a little in my mouth I was rethinking the whole damn thing. While I'm sure this is all "easy" it's also very "different".

APT-GET where foreart though?

So, I played around. I played around A LOT and what I have now is, I feel, the ultimate dev environment for me - and maybe even for you.

In a nutshell it is:

  • all FREE. Yay.

  • a Virtualbox instance of Ubuntu Desktop edition for ultimate flexibility, but launching straight to console for maximum efficiency.

  • Virtualbox configured with a "share" to my OSX Home Folder, mounted at boot by the Linux Guest so all my app files are really in OSX not on the VM

  • Virtualbox configured with a second "Host Only" adapter, so I can ssh from OSX into the Ubuntu VM.

  • An entry in the OSX /etc/hosts so I can refer to the VM as "localhoax" just 'cause.

  • Setup my OSX terminal to BY DEFAULT load and ssh to the VM without a password.

Why???

Well, my rails dev environment then took me about 10 minutes to set up, partly because hey, Linux is the server of choice, but also because I am me, and I know all that stuff already. The end result is that although I fight with some key combination shortcuts, I am benefiting from all the things about Mac that people rave about without any need whatsoever to scratch below the surface. I haven't even installed xCode!

What can I do?

  • apt-get install anything I want that I use for dev

  • Open a terminal (which autoauthenticates and sshs to the VM), cd to my app, and type rails/s or script/server

  • See my rails app from osx browser using http://localhoax:3000

  • No need to learn anything new about OSX