Running Ubuntu on a MacBook Pro

May 26, 2024 · 4 min read

Note: This post is a work in progress, and mainly for my notes. It’s current as of May 2024!.

I had a ten year old MacBook Pro lying around not really doing anything. It wasn’t doing very well with the macOS either, so decided to run Ubuntu on it. Ubuntu was my main development environment from about 2008 until about 2011, and I miss it.

However, as a life long Mac user, the keyboard shortcuts and combinations are too much muscle memory for me to try and move away from. Also, this is a fun side project. I’m not entirely moving over to Ubuntu, so I don’t really want to change my muscle memory too much.

This post tries to explain how best to modify Ubuntu to make it more like the macOS experience from a keyboard point of view. For example Copy and Paste is cmd+c and cmd+v respectively.

Hardware

This post centres around the following hardware:

Identified by lscpu and dmidecode.

I’ve also run a second Samsung monitor with this setup, and all is working fine (tm)!

Key mapping

As per this article we need to update the /usr/share/X11/xkb/symbols/pc file.

So let’s go ahead and update it:

sudo vim /usr/share/X11/xkb/symbols/pc

We need to make these changes (Replace what is already defined for those key mappings).

key <LCTL> {    [ Super_L       ]   };
key <LWIN> {    [ Control_L     ]   };
key <RCTL> {    [ Super_R       ]   };
key <RWIN> {    [ Control_R     ]   };

Once you have made these changes, you need to restart your machine.

Keyboard settings

Now let’s change some keyboard shortcuts in settings.

Let’s update the following sections. Note that the UI here will still say ctrl instead of cmd as we mapped that at an underlying system level.

System

Camera

The camera did not work after the standard install. However, this open source project worked fine for me. Just follow their instructions.

Tmux

If you use tmux, and you did the above, depending on what your leader key was, you might have some issues. Prior to this exercise, I had the leader key set to C-a. This now becomes cmd+a with the above key mapping changes. Yep, this means it’s different depending on whether I’m on macOS, or Linux. I did consider using a different tmux.conf or have an extended one for each OS. However, mapping cmd looked a little tricky.

I’ve capitulated, and moved my leader key to be M-a. This means it will be consistent on both OS’s. This is a minimal change to the way I work, but I can live with it.

However, I did have to make a slight change to iTerm.

Settings… > Profiles and pick your profile. Then Keys, and change Left Option Key to be Esc+.

What I like

So, after all this, what do I actually like about it?

What I’m missing

… but will learn, or learn to adapt.

Summary

I could certainly be a fully functional software engineer on an Ubuntu OS. The fact that a lot of apps are now in your browser really helps. This entire weekend was backed with Spotify playing seamlessly.

Onwards…