A Linux development environment on Mac OS

I’ve been given a Macbook Pro at work. It was actually my choice, since it was the only machine with an US keyboard layout, 16 gig of ram and last but not the least, the easiest way not to use Windows and have a Unix environment at my fingertips.

It’s not too bad, but I’ll post my impressions and opinion another time.

In this post I want to talk about how to get a GNU/Linux development environment on Mac OS without too much hassle. Spoiler alert: yes, I am running a virtual machine.

So I want the following:

  1. decent and configurable amount of ram
  2. being able to share files easily
  3. being able to use native tools (native gcc etc)
  4. being able to edit files within the Linux environment from my Mac OS GNU Emacs (this is mostly because the Mac OS distribution of GNU Emacs correcly recognizes some keystrokes).
  5. being able to run graphical apps, if needed.
  6. being able to start and stop the machine without too much hassle
  7. being able to destroy and recreate the machine easily without losing too much time

Quite a few of requirements.

So what I’m doing is, basically, have Vagrant spawn a Centos 7 virtual machine and then configure it automatically using Ansible. The “cool” things that I’m doing however are:

  • bridging the network interfaces so that I can run stuff and either access such stuff over the network and/or allow other people access it
  • preinstalling samba and pre-loading a simple configuration file
  • pre-installing the “Server with GUI” and “Development tools” groups
  • automatically uploading my ssh public key
  • displaying all the ipv4 addresses for the machine

It’s been a pleasant exercise, and I am quite glad I learnt how to use both Vagrant and Ansible. I’ll dive more into Ansible sooner or later, the more I use it the more I like it.

The Vagrantfile and the Ansible playbook are available in this repository: https://github.com/esantoro/centos-devenv

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.