Developing in Linux on OSX

06 October 2015

I wanted to move to Linux development environment, but at the same time I wanted to stay on OSX for everything else. So VirtualBox was the obvious option. I also had few extra requirements:

If you happen to need something similar, then simply follow TLDR; below.

TLDR;

Provision script will create a user account on the vm with the same name as the user on the host machine you’re running vagrant up from. Following Vagrant convention, the password is ‘vagrant’.

The default RAM size is set to 8gb. You can adjust this in Vagrantfile. Then vagrant reload.

To get host/guest clipboard integration, install XQuartz, set the pasteboard settings to look like this:

and make sure XQuartz is running whenever you vagrant ssh.

You can also build a VMware box (--only=vmware-iso), but I haven’t tried it.

Notes (for the curious)

When I say “development environment” what that really means is console development environment. I use tmux for keeping sessions/windows per project, Vim as an editor and command line for everything else.

This kind of setup is perfectly achievable in OSX of course. The main reason to move to Linux was the lack of native docker support for OSX. “But there is docker-machine (former boot2docker)” I can hear you saying. And that is true. But there is also a range of minor issues (such as no support for host data volumes, or slow VirtualBox file sharing for when you want to develop against running container, or some more obscure ones) that come with it. It is just one more abstraction layer that will always get its toll.

There are other good reasons to use Linux, but, perhaps, it was just that time of the year when one needs to shave a yak, so I thought why not, let us give it a go.

By the way, nice thing about having all work stuff in a VM is that when you need to restart your laptop, it only takes vagrant suspend to pause the VM and vagrant up after restart to pick things up right where you left them. Also setting up new machine is much faster.

Initially I wanted full GUI experience (with i3wm tiling window manager), but the graphics turned out to be far too slow. A bit disappointing, giving the top dog MacBookPro.

Then I decided to use Vagrant with a server box. However stock boxes are set to have 40GB disk and, as I quickly learned, resizing VB disk images involves more steps than a human can follow.

So I ended up forking the base boxes repository, changing the disk size in packer config and building the box myself.

To keep things simple I also dropped the Vagrantfile into the root of my fork. There are three things to note there:


blog comments powered by Disqus