Mac

Installing Arch Linux on an Apple computer is quite similar to installing it on one from any other manufacturer. However, due to specific hardware configurations, there are a few deviations and special considerations which warrant a dedicated guide. For more background information, please see the Installation guide and UEFI. This guide contains instructions that can be used on any Apple computer whose hardware is supported by the Linux kernel. Please see the "related" pages for model-specific tips and troubleshooting.

Warning: ARM architectures are supported by Arch Linux ARM. However, it does not support M1 or future generation chip yet. For Linux support information for Macs with M1 chip, see Asahi Linux project. Both Arch Linux ARM and Asahi Linux are downstream projects that not officially endorsed by Arch Linux, you may go to Arch Linux ARM Forum and Asahi Linux Community for help.

Overview

Summed up, the procedure for installing Arch Linux on a Mac is:

  1. Preinstallation: Miscellaneous steps before partitioning.
  2. Partition: Resizing or deleting the macOS partition to create partitions for Arch Linux.
  3. Install Arch Linux: Actual installation.
  4. Setup boot loader: Making sure that the new partition is bootable.
  5. Post-installation: Device-specific configuration.

Preinstallation

Before proceeding with the installation of Arch Linux, follow these steps.

  1. Install macOS and install its updates. macOS is the only known method for installing firmware updates, even though the OS will not be necessary after installing Arch. See Apple's instructions to install macOS.
  2. Save the display's .icc color profile, likely in /Library/ColorSync/Profiles/Displays/, which can later be used to set the display colors correctly. See color profile.
  3. Set the volume on macOS, which will be the volume of the startup chime. If the volume is muted, the startup chime will also be muted. See mute startup chime.

Partitions

Partitioning of the storage drive is no different from any other PC or laptop. However, if you plan on keeping macOS for dual booting, you should consider that, by default, a Mac drive is formatted using GPT and contains at least 3 partitions:

  • EFI: the ~200 MB EFI system partition.
  • macOS: the main partition containing your macOS installation. It is formatted using HFS+.
  • Recovery: A recovery partition present in almost all Macs running OS X 10.7 or newer. It is usually hidden from macOS but can be viewed with partitioning tools.
Note: In Macs that use the Apple Fusion Drive, the partition scheme could be different.

How to partition depends on how many operating systems you want install. The following options will be explained:

Arch Linux only

This situation is the easiest to deal with. Partitioning is the same as any other hardware that Arch Linux can be installed on. Please refer to the standard Installation guide for details. If you want to configure your system in order to have full-disk encryption, please look at the Dm-crypt/Encrypting an entire system page for details.

An example for a very basic partitioning, that does not consider a separate partition nor encryption or LVM, is the following:

Once done, you can continue to #Installation.

Arch Linux with macOS or other operating systems

You need to partition your hard drive while keeping the partitions used for macOS/Windows. If you wish to keep macOS, the easiest way is to use partitioning tools in macOS and then finish with Arch Linux tools.

Warning: If your macOS partition is encrypted with FileVault 2, you must disable the disk encryption before proceeding. After the macOS partition has been resized, FileVault 2 can be re-enabled.

Procedure:

  • In macOS, run Disk Utility.app (located in )
  • Select the drive to be partitioned in the left-hand column (not the partitions!). Click on the Partition button.
  • Add a new partition by pressing the + button and choose how much space you want to leave for macOS, and how much for the new partition. Keep in mind the new partition will be formatted in Arch Linux, so you can choose any partition type you want.
  • If the above completed successfully, then you can continue. If not, then you may need to fix your partitions from within macOS first.
  • Boot the Arch installation media or LiveUSB by holding down the Alt during boot. Proceed with #Installation.

It is possible to resize the newly created partition from within the Arch installation media, or delete it in order to proceed with the creation of other partitions (eg. swap).

EFI

  • Run cgdisk
  • Delete the partition you made in Disk Utility.app and create the necessary partitions for Arch Linux. macOS likes to see a 128 MiB gap after partitions, so when you create the first partition after the last macOS-partition, type in +128M when cgdisk asks for the first sector for the partition. More information about Apple's partitioning policy can be read here. A simple example (no LVM, crypto):

Once done, you can continue to #Installation.

BIOS-compatibility

  • Run parted as root.
  • Delete the empty space partition and partition the space as you would for any other installation. Note that MBR is limited to 4 primary partitions (including the EFI system partition). That leaves 2 primary partitions for Arch. One strategy is to have a system and home partition, and use a swap file (I have not tried to use logical partitions). Another is to dedicate one partition to a shared partition (see below).
  • Next, create new filesystems on those partitions which need them, especially the partition which will contain . If you are not sure how to do this using (or whatever), run /arch/setup and work through until you get to Prepare Hard Drive and use the "Manually configure block devices..." option, then exit the installer. This is necessary so that rEFIt will set the right partition type in the MBR in the next step (without an existing filesystem, it seems to ignore the partition type set by parted), without which GRUB will refuse to install to the right partition.
  • At this point you should reboot your computer and have rEFIt fix the partition tables on your hard drive. (If you do not do this, you may have to reinstall GRUB later on in order to have your Mac recognize the Linux partition.) When you are into the rEFIt menu, select update partition table, then press . Reboot.
  • Done, you can continue with #Installation.

Installation

Note: This section is only required if you want to have macOS installed along with Arch Linux. If not, follow the steps in the official install guide, then skip to /Troubleshooting.
  • Boot from the Arch Linux install CD, or from a manually created bootable USB drive.
  • Proceed through the installation as described in the Installation guide except in the following areas:
  • When the install process is complete, reboot your computer.
  • If using optical media, hold down the eject key as your Mac starts, this should eject the Arch Linux install disk.
  • If dual-booting macOS and Arch Linux with systemd-boot or GRUB, hold down the Alt (option) key while the system boots to use the Mac boot loader and select which OS to boot.

Setup boot loader

Using rEFInd

These steps assume a dual-OS installation of Arch, and assuming the steps of the Installation guide were completed up to Installation guide#Boot loader. The rEFInd boot manager can replace Apple's boot menu, and can boot into Arch without requiring systemd-boot or GRUB. Boot into Safe Mode by holding down Command-R, then disable SIP.

# csrutil disable

Boot into MacOS, download rEFInd, and run its install script,

# ./install-refind

rEFInd installed itself into Apple's boot partition, and replaced Apple's boot menu with its own. Boot into Safe Mode by holding down Command-R, and enable SIP.

# csrutil enable

Reboot without holding down any keys, and boot into Arch by selecting .

Using the native Apple boot loader with systemd-boot (Recommended)

Apple's native EFI boot loader reads files located inside the EFI system partition at . Luckily, this is also the default install location for the systemd-boot binary. This means that booting linux using systemd-boot is very simple.

  • First, make sure you mounted the EFI System Partition at
  • Proceed with #Installation normally
  • Once inside the chrooted environment, type the following command to install systemd-boot: The above command will copy the systemd-boot binary to and add systemd-boot itself as the default EFI application (default boot entry) loaded by the EFI Boot Manager.
  • Proceed to systemd-boot#Configuration in order to correctly set up the boot loader

At the next reboot, the Apple Boot Manager, shown when holding down the option key when booting the Mac, should display Arch Linux (it will be displayed as EFI Boot as a possible boot option.

Tip: If you installed Arch Linux alongside macOS, you will be able to change the default boot location from system Settings inside macOS. If Arch Linux does not show up as a possible boot option, you will have to mount the EFI System Partition inside macOS before selecting your boot option:
# mkdir -p /Volumes/EFI
# mount_msdos /dev/disk0s1 /Volumes/EFI

Installing GRUB to existing EFI system partition

If you would like to use GRUB as your main boot loader and use the "boot while holding the Alt/Option key" method to go back to macOS rather than using alternatives such as rEFIt (https://refit.sourceforge.net/, mentioned previously in #BIOS-compatibility) then you must install GRUB to your Mac's already-existing EFI system partition.

The process is similar to #Using the native Apple boot loader with systemd-boot (Recommended). Just follow GRUB#Installation and add when running .

Installing GRUB to a separate HFS+ partiton

Despite using UEFI, the Mac native EFI boot loader does not use the EFI system partition for booting. Instead, it looks for .efi files inside all the partitions in internal and external drives and shows them as possible boot options if certain conditions are satisfied. For example, it can detect an existing macOS installation after checking that:

  • there is a partition formatted as HFS+
  • the partition contains the partition id
  • in the root of that partition, there is a file called
  • inside that partition, there a file inside

This means that configuring an Arch installation to be automatically recognized by the Mac boot loader is possible. Moreover, it simply requires a properly-formatted HFS+ partition and does not require meddling with the EFI system partition. The advantage of this method is that it can coexist with macOS nicely and allows to avoid other boot loaders such as rEFInd. However, this requires manual configuration. The following steps will illustrate how to perform this configuration using GRUB.

  • First, while configuring a new Arch installation, create a separate partition. Many tools are available in the Arch ISO, for example cgdisk.
  • Make sure the partition is at least ~250 MB in size, since it will be used to store the kernel as well as any custom kernel you will install in the future. Moreover, make sure the partition type is set as Apple HFS/HFS+ (it will appear as in fdisk/cgdisk or in gdisk)
  • Since the Arch installation ISO does not include the package, we need to install it in the installation environment before proceeding with formatting the new partition as HFS+, install hfsprogsAUR, then:
# modprobe hfsplus
# mkfs.hfsplus /dev/sdXY -v "Arch Linux"
  • Once inside the chrooted environment, install the grub and packages.
  • Also, create a dummy file
# touch /boot/mach_kernel
# mkdir -p /boot/EFI/arch && touch /boot/EFI/arch/mach_kernel
  • The following steps install the GRUB UEFI application to and install its modules to .
# grub-install --target=x86_64-efi --efi-directory=/boot

After that, remember to create a standard configuration file:

# grub-mkconfig -o /boot/grub/grub.cfg

As you can see, the directory structure of the is not correct, as the directory is not supposed to be a subdirectory of the folder. For this reason, we need to relocate the stub in a location the Mac boot loader is able to recognize:

# mv /boot/EFI/arch/System/ /boot/
# rm -r /boot/EFI/

After that, you need to create the following file

At the next reboot, the Apple Boot Manager, shown when holding down the option key when booting the Mac, should display Arch Linux as a possible boot option. Selecting that option will boot GRUB.

Done! GRUB can now be selected on the standard Mac boot loader and you can boot into your newly installed Arch Linux.

Using blessing

It is possible to boot directly from GRUB in EFI mode without using rEFIt through what is known as "blessing" after placing GRUB on a separate partition. These instructions are known to work on a MacBook7,1. It is advisable to host GRUB on either a FAT32 or HFS+ partition, but ext2 or ext3 may also work.

After the GRUB install is in the desired location, the firmware needs to be instructed to boot from that location. This can be done from either an existing macOS install or an macOS install disk. The following command assumes that the GRUB install is in on an existing macOS partition:

# bless --folder /efi/grub --file /efi/grub/grub.efi

Tips and tricks

Color Profile

The package can load the macOS .icc color profiles. macOS stores color profiles both in /Library/ColorSync/Profiles/Displays/ and /System/Library/ColorSync/Profiles/Displays/. Copy those profiles to the Arch filesystem and load one using

$ xcalib profile.icc

To know which profile to load, use these hints

  • for MacBook Pro with CoreDuo CPU
  • Color LCD-4271880.icc for MacBook with Core2Duo
  • for MacBook (non-Pro) based on CoreDuo or Core2Duo.
  • for MacBookPro9,2 (Mid-2012)

If none of the color profiles in the macOS filesystem seem correct, the current profile can be saved using ColorSync Utility or using System Preferences > Displays > Color.

Apple Remote

Install and configure . See LIRC.

Make LIRC use or :

Use irrecord to create a configuration file matching your remote control signals:

# irrecord -d /dev/usb/hiddev0 -H macmini output_conf_file

Start and use irw to check if it works.

Alternatively, use the following:

/etc/lirc/lircd.conf
begin remote

  name  lircd.conf.macbook
  bits            8
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   24
  pre_data       0x87EEFD
  gap          211994
  toggle_bit_mask 0x87EEFD01

      begin codes
          Repeat                   0x01
          Menu                     0x03
          Play                     0x05
          Prev                     0x09
          Next                     0x06
          Up                       0x0A
          Down                     0x0C
      end codes

end remote

HFS partition sharing

Install and use fdisk to list the partitions:

The "Unknown" partition is our macOS partition, which is located in . We can use this in our fstab:

It can then be mounted, and the content accessed.

Journaling

HFS+ partitions, now the default in macOS, are not fully supported by Linux and are mounted as read-only by default. In order to write to an HFS+ partition, the safe way is to disable journaling. This can be accomplished using the macOS Disk Utility. Refer to this Apple support page for more information or try to do it from the command line:

Find your partition:

In this example we will use disk0s3 partition named as Macintosh HD. To know if journaling is activate or not you could execute:

# diskutil info /dev/disk0s3 | grep -i journal
    File System Personality:  Journaled HFS+
    Name (User Visible):      Mac OS Extended (Journaled)
    Journal:                  Journal size 49152 KB at offset 0x1176000

As you can read the journaling is active. To turn off the journaling you could execute:

# diskutil disableJournal disk0s3

To verify it is done execute the info command again.

If you get noting as output, then journaling is disabled.

However, if you fail to disable journaling. You can change "auto,user,rw,exec" in to "auto,user,force,rw,exec" and mount it.

Yosemite and later

This section addresses error message when mounting hfsplus partition:

Since Yosemite, HFS+ partitions are now wrapped a CoreStorage volume. Verify that you have an CoreStorage volume.

HFS+ uses two volume headers, one 1024 bytes into the device and one 1024 from the end of the device. With the HFS+ partition wrapped in the CoreStorage volume the end of the partition is not actually 1024 bytes from the end of the partition. To fix this you need to specify sizelimit=X when mounting.

To determine do the following:

  1. Run and select your drive
  2. Select
  3. Select and then

Sample output:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Disk /dev/sdX  - 320 GB / 298 GiB - CHS 38913 255 63
    Partition     Start      End        Size in sectors
P  EFI System     40         409639     409600  [EFI]
P  Mac HFS        409640     623147815  622738176
P  Mac HFS        623872872  625142407  1269536

What you see now is the output of the HFS partition itself without the CoreStorage volume. Take the size in sectors (622738176 in this example) and multiply by the number of bytes in your logical sector size (512 in this example).

622738176 * 512 = 318841946112

Finally, mount your disk with the sizelimit=X option.

 mount /dev/sdX -t hfsplus -o ro,sizelimit=318841946112
Change UID and GID(s)

The default UID and GID on Arch Linux for a user is 1000, adjust the following steps according to your setup.

Pre-Leopard
  1. Open NetInfo Manager located in the folder.
  2. If not done for you already, enable access to user account transactions by clicking on the closed lock at the bottom of the window, and entering your account password, or root password if you have created a root account.
  3. Navigate to
  4. Change the UID value to 1000
  5. Change the GID value to 1000
  6. Navigate to /groups/new_user_name, automatically saving the changes you have made so far.
Leopard

In Leopard, the NetInfo Manager application is not present. A different set of steps is required for UID synchronization:

  1. Open System Preferences.
  2. Click on Users & Groups.
  3. Unlock the pane if not already done so.
  4. Right-click on the desired user and select Advanced Options.
  5. Write down the value of the User ID field, you will need it later on. Change both the UID and GID to match the UID and GID of the account to be shared with in Arch.
Change "Home" permissions
  1. Open up Terminal in the folder.
  1. Enter the following command to reclaim the permission settings of your home folder:
# find /User/your_user_name -user your_old_UID -exec chown your_user_name:your_user_group {} \;

In Arch

To synchronize your UID in Arch Linux, you are advised to perform this operation while creating a new user account. It is therefore recommended that you do this as soon as you install Arch Linux.

Now you must substitute Arch's home with macOS's home, by modify entries of .

Mute startup chime

The startup chime volume is controlled by the EFI variable SystemAudioVolume-7c436110-ab2a-4bbb-a880-fe41995c9f82. So it can be muted with

# printf "\x07\x00\x00\x00\x00" > /sys/firmware/efi/efivars/SystemAudioVolume-7c436110-ab2a-4bbb-a880-fe41995c9f82

Bear in mind that the file may have the immutable bit set by default, which will prevent even root from overwriting the file. See File permissions and attributes#File attributes. To remove it, issue the following:

# chattr -i /sys/firmware/efi/efivars/SystemAudioVolume-7c436110-ab2a-4bbb-a880-fe41995c9f82

After that, run the command and it should overwrite the file properly. Verify the file's contents and then set the immutable bit again with once satisfied.

Alternatively, you can use a macOS install disk to mute the chime. Boot from it, select language, then click Utilities > Terminal, and enter

# /usr/sbin/nvram SystemAudioVolume=%percentage
gollark: You need to craft them with glowstone to get more than... 7 or so light.
gollark: Yes.
gollark: Just 3D-print lights.
gollark: Yes, PIR uses HTTP requests to transmit incidents, what of it?
gollark: I fully expect it to be reverse-engineered within a week or so if anyone actually cares, but meh.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.