Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cobaohieu/4a4074f6c65d3d3b9141d16541236969 to your computer and use it in GitHub Desktop.
Save cobaohieu/4a4074f6c65d3d3b9141d16541236969 to your computer and use it in GitHub Desktop.
How to install Ubuntu on Apple Macbook Pro 15-inch (2015)

Acknowledgements Install Ubuntu on Macbook Pro

Requirements

2 USB drives >= 8GB

Pre-Install

Create bootable USB drive

  1. Grab the latest Ubuntu Desktop iso image

2 Create bootable USB drive

a. Method 1: Extract iso to USB with 7z

  • Download 7z for macOS
  • Unzip 7z2409-mac.tar.xz
  • Open Terminal and cd to the 7z2409-mac folder than type as below
./7zz x -y "ubuntu-iso-name.iso" -o"drag-USB-name-here"
  • Wait for a few minutes and you have a Ubuntu Bootable USB

b. Method 2: Using Balena Etcher to create usb bootable as these steps were paraphrased here

  1. Eject the USB drive with Finder or Terminal command line below
`diskutil eject /dev/diskN` (where N is the device)

Prep Macbook Disk

It's important to resize your disk using Disk Utility from inside of MacOS instead of using the Ubuntu installer. Don't worry about creating all the individual partitions right now, the partition creation will be handled during the install.

  1. Open Disk Utility in MacOS
  2. Choose Macintosh HD on the left side of the window
  3. Click on Partition on the right side of the window
  4. Click the + to add a new partition
  5. Resize the new partition and choose to leave it as free space

Driver Packages

Download the packages for bcmwl-kernel-source and dkms to another USB drive. We will use these packages in a later step to enable wifi.

Install

Ubuntu Installer

Plug in the USB drive that contains your Ubuntu image and reboot your Macbook. Once the screen goes black, hold down the Alt key until you see the boot menu. Choose EFI boot from the boot menu. You will be presented with the Grub menu, select 'Install Ubuntu'.

IMPORTANT: When you reach the screen in the installer titled "Installation Type", you must choose the option "something else". This allows for custom partitioning, if you let the installer choose, you may not be happy with the result.

Create whatever partitioning scheme you'd like, for example:

swap  swap 4GB
/     ext4 10GB
/home ext4 Remainder

NOTE: I recall reading somewhere that it was important to leave the 0MB free space partition between the MacOS partitions and the linux partitions, but I have been unable to find that reference.

IMPORTANT: Under Device for bootloader, ensure the EFI partition is selected /dev/sda1

Finish up the installation and boot into Ubuntu.

Post-Install

Hardware Prerequisites

You'll need at least the following hardware:

At least enough USB-A to USB-C converters or hub with enough ports for at least 3 USB devices if all your devices are USB-A:

  1. A USB drive with Ubuntu on it
  2. A USB keyboard
  3. A USB Mouse

Optional: USB to Ethernet adapter, compatible USB Wifi or USB tethering on a phone

General notes

I strongly recommend against deleting OSX entirely even if you'll never use it, it is required for locating the WiFi firmware during install and can be valuable for determining which hardware you have.

If you want to triple boot, I'd recommend installing Windows 10 before Linux, via bootcamp. If it isn't obvious, you'll need to create a partition using Disk Utility in MacOS to make room another OS partition. You'll actually want to partition drive and not just add another logical volume. Google it, if you need help with this. It's pretty well documented. NOTE: The following steps will mess up Windows boot (the install is safe). There's a fix for that at the end.

  1. Download Ubuntu 24.04 (Noble Numbat)

As of this writing, 24.04 is the only Ubuntu version out there that uses kernel 5.4, which is when the linux kernel gained the ability to access the internal Apple NVME SSD.

Download from here: https://releases.ubuntu.com/24.04.1/ubuntu-24.04.1-desktop-amd64.iso

  1. Use your favorite program to write the ISO to a USB stick (Balena etcher for Mac, etc).

Installation

You'll need to use a USB keyboard for the installation

Insert the USB stick and boot the laptop holding down the "option" key to seelct the USB for boot (it'll be an orange EFI disk. Choose the far right one, if there are multiple.)

The text will be tiny, but choose the second option (try Ubuntu without installing (Safe graphics).

I don't know what the issue is, but grub and/or Ubuntu really don't like this laptop. Therefore, we're going to install Ubuntu WITHOUT a bootloader. To do this, open up a terminal and type sudo ubiquity -b Proceed to install as normal and make sure you're installing to the empty partition you made and not MacOS or Windows.

On reboot, your laptop should boot directly into MacOS as there's no way to boot into linux at this point. Download REFIND from sourceforge and install it the standard way.

REFIND: https://sourceforge.net/projects/refind/

Installation Instructions: https://www.rodsbooks.com/refind/installing.html

Reboot. You should be able to select Ubuntu now via REFIND. Boot into Ubuntu.

Fixing bootcamp/Windows

If you had installed Windows 10 via bootcamp prior to intalling Ubuntu, you may have noticed that Windows no longer boots. Fear not! Windows is still there, but for some reason, bootcamp installs Windows 10 in hybrid legacy/GPT mode instead of the regular UEFI. Here's the fix:

  1. Boot into linux

  2. Open a terminal and type sudo gdisk /dev/nvme0n1

  3. Push x for expert mode

  4. Press n to create a protective MBR

  5. Press w to write the partition and y to confirm

  6. If you're not automatically exited from gdisk, then type q to exit

Reboot and hold down the option key to choose the boot drive. Pick Windows and confirm it loads properly. If so, you'll need to reboot back into MacOS and reinstall rEFInd. This should resolve any weird boot behavior (ie, no more win10, resetting MacOS password, etc).

Using the integrated GPU to save battery life

You'll need to spoof the Macbook Pro into thinking it's booting into MacOS when it's really booting into Linux (this also works for Windows!). Follow the directions here:

https://github.com/0xbb/apple_set_os.efi

Bootloader

Add MacOS as option on Grub menu

Append the following lines to /etc/grub.d/40_custom:

menuentry "MacOS" {
 exit
 multiboot /boot
}

Change these options in /etc/default/grub:

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=igfx_off"
GRUB_CMDLINE_LINUX=""

Fix small grub fonts

On the command line execute the following:

sudo grub-mkfont -s 36 -o /boot/grub/DejaVuSansMono.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

Open and edit again /etc/default/grub and add the following line at the bottom:

GRUB_FONT=/boot/grub/DejaVuSansMono.pf2

Update Grub

sudo update-grub
or
sudo update-grub2

Common issues

Fan not working properly

The Macbook Pro's fan requires a daemon to adjust the speed.

Add the following to /etc/modules:

coretemp
applesmc

Install build-essential package: sudo apt install build-essential mbpfan -y

Or clone source and combine by your self

Clone the mbpfan source:

git clone [email protected]:dgraziotin/mbpfan.git

Follow directions found here to build and install: A beginner's tutorial for mbpfan under Ubuntu

Missing FacetimeHD camera.

Reference this script here: https://gist.github.com/cobaohieu/b29f4e378b6ecf8851835988ce45c436.js

Install Wifi

sudo apt install -y firmware-b43-installer

Install another packages

sudo add-apt-repository ppa:aglasgall/pipewire-extra-bt-codecs -y
sudo apt update
sudo apt-get install ubuntu-restricted-extras -y
sudo apt-get install -y ffmpeg gstreamer1.0-libav libdvdnav4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg gstreamer0.10
sudo apt-get install -y curl wget openjdk-18-jdk openjdk-17-jdk openjdk-21-jdk openjdk-11-jdk
sudo apt install -y vlc

References

Installing Ubuntu 15.04 on a Macbook Pro 11,2

Arch - MacBookPro

Installing Ubuntu 15.10 - Wily Werewolf on a Macbook Pro 12-1 (2015)

Wifi doesn't work after suspend after 16.05 upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment