If you’re using a Macintosh keyboard while running Linux Ubuntu machine, you may have noticed that there’s an issue with the Left Alt key. You cannot use it with Shift the same way as you do on a Mac when it comes to typing characters such as pipes (|), square brackets ([]) or curly braces ({}).

Instead, you have to use the Right Alt, which is cumbersome and quite boring when these special characters are something you have to type often. Which is probably the case if you’re coding, using the Command Line or if you have to administer a Linux server.

I’ve looked around for quite a while to find a solution. There are ways to do so that imply running this line and find the right options:

Copy to Clipboard

Other solutions suggest to directly edit the keyboard layout file, which are located in the /usr/share/X11/xkb/symbols/ folder. This may be the best, but it’s also the most technical solution and you must to be quite sure what each part of the symbol stands for. If you’d like to explore this solution, you can find resources on Ubuntu documentation, Ask Ubuntu or here.

A Simple Solution to Reconfigure the Left Alt Touch on the Macintosh Keyboard

In this tutorial, we’re going to see a much simpler solution (from the user’s point of view). We’re simply going to install a software and choose the option we’re looking for. Here’s how to do this:

1. Install GNOME Tweaks

Head to the Ubuntu Software app look for a software named GNOME Tweaks. Here’s a screen-capture of the software once it’s installed.

Search for GNOME Tweaks on Ubuntu Software

If you prefer to install via the command line interface, open your terminal and type the following lines. First, you’ll update your system:

Copy to Clipboard

After entering your password and running the command, type the next one to install GNOME Tweaks:

Copy to Clipboard

Now, you can launch it like any other program on Ubuntu. Simply click on the app launcher and enter its name. If you installed it via the CLI, you know how to do that for sure!

2. Enter the “Keyboard & Mouse” options

Once you have the program running, go in the “Keyboard & Mouse” options. That’s where we’ll access the next panel of options, which will allow to modify the default behavior of the Left Alt key on Ubuntu (or at least the behavior for a Macintosh keyboard layout).

The keyboard and mouse options in GNOME Tweaks

3. Click on the “Additional Layout Options” button

That’s where you’ll find the option we’re looking for. More exactly, you’ll need to open the “Key to choose the 3rd level” sub-menu. Here is how it looks like:

Choose the key to 3rd level in the additional layout options

As you see, I chose the “Any Alt” option. Checking that box allows me to use the left alt key the same way as I do on my Mac computer. Typing pipes, square brackets and curly braces doesn’t require me to use the right alt anymore, which feels quite good!

Note that you can also choose another option and use the “Left Alt” key to achieve that result. The best is that you play around with the shortcuts and the behavior of the keyboard, to see what’s the best option for you.

One downside of that solution, is that now the alt + tab command doesn’t switch through the open apps anymore… That’s why I’ve remapped the Switch Windows keyboard shortcut to ctrl + tab. You can do so in Settings > Keyboard Shortcuts.

A better way to solve this would be to remap the Switch Windows shortcut to cmd + tab, which would be the same as on a Apple computer. But that’s more complicated as the cmd key is used by VirtualBox. If you know how to do that though, don’t hesitate to leave a comment in the section below.

Big up: the solution shown here in order to use the left alt key the same way as the right alt key for a Macintosh keyboard on Ubuntu and Linux was initially briefly described in this thread.