How to setup Ubuntu on a MacBook Pro

Published on 2018/01/02 Last updated on 2018/06

Table of contents

These instructions were tested on a MacBook Pro Mid 2014.
Should —probably— work just fine on other MacBooks.


If you install Ubuntu on a MacBook, you’ll soon find a small —but highly irritating— set of behaviours:

  • The Alt and Cmd keys are swapped out (using a PC keyboard as a reference).
  • The function keys are swapped out with the multimedia keys.
  • Cannot easily copy & paste on the CLI with the laptop’s keyboard.
  • The trackpad behaves erratically.
  • You can hardly read anything on the screen or…
  • Maybe the UI size is too big and you’d want to adjust it to your liking.

If this sounds like your kind of problems, then keep reading, solutions are ahead.
Right now, the only issue without a solution is the integrated webcam. It does not work.

Keyboard issues

Swap Cmd and Alt keys

If you’d like your Alt key where it usually is on every PC —except Macs. With immediate effect, but temporary:

echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd

Make it permanent:

echo options hid_apple swap_opt_cmd=1 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all

Enable function keys

This will make your function keys available by default. To use your multimedia keys, you’ll now need to hold the fn key while pressing a multimedia one.

With immediate effect, but temporary:

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

This change is not permanent. To make it so:

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all

Daily usage

Copy & pasting

You can paste stuff using a 3-finger touch/click on the trackpad, after highlighting some text.

You can also use the mouse.

You could also configure a seldom used keyboard key to paste stuff.

What about using the Right Super key for pasting? —if you swapped the Cmd and Alt keys, it’s the one labeled as Alt now.

sudo apt install xkbset

echo "" >> ~/.bashrc
echo "xmodmap -e \"keycode 134 = Pointer_Button2\"; xkbset m" >> ~/.bashrc

It works just like when you highlight some text with the mouse then click the middle button to paste it somewhere else.

Whenever you highlight text with your mouse in Ubuntu, it is copied to a special buffer that you can paste from clicking the mouse’s mid button.

Pasting in the CLI is usually done with Shift + Ins, good luck finding the Insert key.

High DPI displays

i3 Ubuntu

If you are using i3, your screen’s text is probably way too small, to adjust the display scale you need to change the screen mode —resolution, if you will. Open a terminal and type:

xrandr --output eDP-1 --mode 1680x1050

If that is still too small, try with:

xrandr --output eDP-1 --mode 1440x900

What we did was to downscale the resolution from 2560x1600 to 1680x1050 —or 1440x900.

TIP ~ Back to login screen

On i3 you can close your session with: Shift + Super + E.

Super is the Windows key.

If you, somehow cannot press that combination, you can use (with caution), the next command:

kill -9 -1

This will terminate all the user processes, and get you back to the login screen.

  • DO NOT execute it with sudo.
  • DO NOT execute it if you have unsaved data.

— lt

Feedback & comments

Get in touch on Twitter

Or by good ol' email at adriandcs@gmail.com