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.
Overview
Summed up, the procedure for installing Arch Linux on a Mac is:
- Firmware updates: It always helps to start from a clean, backed up, and up-to-date install of macOS.
- Partition: Resizing or deleting the macOS partition to create partitions for Arch Linux.
- Setup boot loader: Making sure that the new partition is bootable.
- Install Arch Linux: Actual installation.
- Post-installation: Mac-specific configuration.
Firmware updates
Before proceeding with the installation of Arch Linux, it is important to ensure that the latest firmware updates for your Mac are installed. This procedure requires macOS. In macOS, open the App Store and check for updates. If your Mac finds and installs any updates, make sure to reboot your computer, and then check again for updates to make sure that you installed everything.
It is advisable to keep macOS installed, because Mac firmware updates can only be installed using macOS. However, if you plan to remove macOS completely, make backups of the files in /Library/ColorSync/Profiles/Displays/
, which you will need in Linux for adjusting the color profile.
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.
How to partition depends on how many operating systems you want install. The following options will be explained:
- Single boot: #Arch Linux only
- Dual boot: #Arch Linux with macOS or other operating systems (recommended so you can still return to macOS when needed)
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 /home
partition nor encryption or LVM, is the following:
partition mountpoint size type label /dev/sda1 /boot 200MiB vfat EFI /dev/sda2 /swap adjust swap swap /dev/sda3 / remain ext4 root
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.
Procedure:
- In macOS, run Disk Utility.app (located in
/Applications/Utilities
) - 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).
Option 1: 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):
- The swap partition is optional on machines with 4GB of RAM or more. A swap file can be created later.
- The easiest dual-boot option is to install rEFInd from inside macOS, to its root directory (default for
install.sh
). Following that, copy the driver folder from the installation tarball into the new rEFInd location, and uncomment the lines "scan_all_linux_kernels" and "also_scan_dirs" options inrefind.conf
. Configuration of boot options can then be done from arefind_linux.conf
in Arch's/boot
directory. - If you want to be able to boot GRUB from the Apple boot loader, you can create a small hfs+ partition (for convenience, use macOS to format it in Disk Utility.app afterwards). Follow the GRUB EFI install procedure, and mount your
/efi
directory to the hfs+ partition you created. Finally, finish up again in macOS by blessing the partition. This will set GRUB as the default boot option (holding alt at startup goes to the boot options screen still. See https://mjg59.dreamwidth.org/7468.html)., - An existing EFI system partition can be used by Arch Linux without needing to create an additional one.
- For more information on partitioning, see Partitioning
partition mountpoint size type label /dev/sda1 /efi 200MiB vfat EFI /dev/sda2 - ? hfs+ macOS /dev/sda3 - ? hfs+ Recovery /dev/sda4 - 100MiB hfs+ Boot Arch Linux from the Apple boot loader (optional) /dev/sda5 /boot 100MiB boot boot /dev/sda6 - ? swap swap (optional) /dev/sda7 / 15-20GiB ext4 root /dev/sda8 /home remaining ext4 home
Once done, you can continue to #Installation.
Option 2: 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
/boot
. If you are not sure how to do this usingmkfs.ext2
(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
y
. Reboot. - Done, you can continue with #Installation.
Setup boot loader
Using the native Apple boot loader with systemd-boot (Recommended)
Apple's native EFI boot loader reads .efi
files located inside the EFI system partition at /EFI/BOOT/BOOTX64.EFI
. 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
/boot
- Proceed with #Installation normally
- Once inside the chrooted environment, type the following command to install systemd-boot:
# bootctl --path=/boot install
The above command will copy the systemd-boot binary to/boot/EFI/BOOT/BOOTX64.EFI
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.
$ diskutil mount disk0s1
Using the native Apple boot loader with GRUB
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 (http://refit.sourceforge.net/, mentioned previously in #Option 2: 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 --removable
when running grub-install
.
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
af00
- in the root of that partition, there is a file called
mach_kernel
- inside that partition, there a
boot.efi
file inside/System/Library/CoreServices
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+ /boot
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
/boot
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
Apple HFS/HFS+
in fdisk/cgdisk oraf00
in gdisk) - Since the Arch installation ISO does not include the hfsprogsAUR 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"
- Done, proceed with #Installation
- Once inside the chrooted environment, install the grub and efibootmgr packages.
- Also, create a dummy
mach_kernel
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
/boot/EFI/arch/System/Library/CoreServices/boot.efi
and install its modules to/boot/grub/x86_64-efi
.
# 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 boot.efi
is not correct, as the /System/Library/CoreServices
directory is not supposed to be a subdirectory of the /boot/EFI/
folder. For this reason, we need to relocate the boot.efi
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
/boot/System/Library/CoreServices/SystemVersion.plist
<?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> <key>ProductBuildVersion</key> <string></string> <key>ProductName</key> <string>Linux</string> <key>ProductVersion</key> <string>Arch Linux</string> </dict> </plist>
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.
$ wget -O /tmp/archlinux.svg https://archlinux.org/logos/archlinux-icon-crystal-64.svg $ rsvg-convert -w 128 -h 128 -o /tmp/archlogo.png /tmp/archlinux.svg # png2icns /boot/.VolumeIcon.icns /tmp/archlogo.png $ rm /tmp/archlogo.png $ rm /tmp/archlinux.svg
Obviously, you can replace the Arch logo with any other icon you like.
Other methods
If you are going for an Arch Linux-only setup, installing the boot loader is no different than on any other machine: Install systemd-boot, rEFInd or other boot loader of your choice.
If, on the other hand, you are dual/triple booting, then read on.
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 /efi/grub/
on an existing macOS partition:
# bless --folder /efi/grub --file /efi/grub/grub.efi
Installation
- Boot from the Arch Linux install CD, or from a manually created bootable USB drive.
arch noapic irqpoll acpi=force
.
- Proceed through the installation as described in the Installation guide except in the following areas:
- Skip the partition the disks stage, do only the partition formatting and mounting steps, taking care to assign the correct partitions. Partitions have already been created if you followed #Partitions
- When at the install boot loader stage, follow #Setup boot loader
- (for booting with BIOS-compatibility) Add
reboot=pci
as a kernel parameter. This will allow your Mac to reboot correctly from Arch. - In the configure system stage, edit
/etc/mkinitcpio.conf
and ensure the keyboard hook is after the autodetect hook. This will load the drivers for your keyboard in case you need to use it before Arch boots (e.g. entering a LUKS password or using the troubleshooting shell).
- 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, hold down the
Alt
(option) key while the system boots to use the Mac boot loader and select which OS to boot.
Tips and tricks
Color Profile
We can use color profiles from macOS.
First, install the xcalib package.
Second copy pre-saved color profiles placed in /Library/ColorSync/Profiles/Displays/
on macOS partition to ~/colorprofiles/
for example.
There are color profile files agree with in MacBook models; select the right one:
- Color LCD-4271800.icc for MacBook Pro with CoreDuo CPU
- Color LCD-4271880.icc for MacBook with Core2Duo
- Color LCD-4271780.icc for MacBook (non-Pro) based on CoreDuo or Core2Duo.
/Users/<username>/Library/ColorSync/Profiles
.Finally you can activate it by running
# xcalib ~/colorprofile.icc
- The previous command sets the color profile only for the current session: autostart it.
- GNOME will revert the profile set by xcalib. It is preferable to set the profile using Color in settings.
Apple Remote
Install and configure lirc. See LIRC.
Make LIRC use /dev/usb/hiddev0
or /dev/hiddev0
:
/etc/conf.d/lircd
# # Parameters for lirc daemon # LIRC_DEVICE="/dev/usb/hiddev0" LIRC_DRIVER="macmini" LIRC_EXTRAOPTS="" LIRC_CONFIGFILE="/etc/lirc/lircd.conf"
Use irrecord to create a configuration file matching your remote control signals:
# irrecord -d /dev/usb/hiddev0 -H macmini output_conf_file
Start lircd.service
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 hfsprogsAUR and use fdisk to list the partitions:
# fdisk -l /dev/sda
Device Boot Start End Blocks Id Type /dev/sda1 1 26 204819 ee GPT /dev/sda2 26 13602 109051903+ af Unknown /dev/sda3 * 13602 14478 7031250 83 Linux /dev/sda4 14478 14594 932832+ 82 Linux swap / Solaris
The "Unknown" partition is our macOS partition, which is located in /dev/sda2
. We can use this in our fstab:
/etc/fstab
/dev/sda2 /path/to/shared/hfs_partition hfsplus auto,user,rw,exec 0 0
It can then be mounted, and the content accessed.
HFS+ Partitions
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:
# diskutil list
/dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *750.2 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_HFS macOS 149.5 GB disk0s2 3: Apple_HFS Macintosh HD 599.2 GB disk0s3 4: Apple_Boot Recovery HD 650.0 MB disk0s4
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 /etc/fstab
to "auto,user,force,rw,exec" and mount it.
Yosemite and later
This section addresses error message when mounting hfsplus partition:
# mount -t hfsplus dev/sdX force,ro
wrong fs type, bad option, bad superblock on /dev/sdX, missing codepage or helper program, or other error.
Since Yosemite, HFS+ partitions are now wrapped a CoreStorage volume. Verify that you have an CoreStorage volume.
# fdisk -l /dev/sdX
Disk /dev/sdX: 298.1 GiB, 320072933376 bytes, 625142448 sectors Units: sectors of 1* 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Device Start End Sectors Size Type /dev/sdX1 40 409639 409600 200M EFI System /dev/sdX2 409640 623872871 623463232 297.3G Apple Core storage /dev/sdX3 623872872 625142407 1269536 916.0M Apple boot
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 /dev/sdX2
partition. To fix this you need to specify sizelimit=X
when mounting.
To determine sizelimit
do the following:
- Run
testdisk /dev/sdX
and select your drive - Select
EFI GPT
- Select
Analyse
and thenQuick Search
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
UID synchronization for home sharing
In macOS
Step 1: 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
- Open NetInfo Manager located in the
/Applications/Utilities
folder. - 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.
- Navigate to
/users/new_user_name
- Change the UID value to 1000
- Change the GID value to 1000
- 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:
- Open System Preferences.
- Click on Users & Groups.
- Unlock the pane if not already done so.
- Right-click on the desired user and select Advanced Options.
- 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.
Step 2: change "Home" permissions
- Open up Terminal in the
/Applications/Utilities
folder.
- 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 /etc/fstab
.
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 printf
command and it should overwrite the file properly. Verify the file's contents and then set the immutable bit again with chattr +i
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
Troubleshooting
See General recommendations for system management directions and post-installation tutorials like setting up a graphical user interface, sound or a touchpad.
Video
Different Mac models have different graphic cards. To see which graphics card you have type:
$ lspci | grep VGA
- If it returns a string containing
Intel
, read Intel graphics. - If it returns
NVIDIA
, read NVIDIA. - If it returns two lines, with both
NVIDIA
andIntel
, your Mac has dual graphics. See MacBookPro10,x#Graphics for an example of one such setup that might apply in other cases.
- Otherwise if it returns
ATI
orAMD
, read ATI.
NVIDIA
If you boot in EFI mode and NVIDIA binary drivers are working only in BIOS mode (e.g. you get black screen on EFI boot), try the approach described on Ask Ubuntu.
For the backlight to work properly you may need the nvidia-bl-dkmsAUR package. If backlight control does not work afterwards, you should blacklist the apple_bl
kernel module. If backlight control does not work even this way, try setting options nvidia_bl max_level=0x1ffff shift=11
in /etc/modprobe.d/nvidia_bl.conf
.
Alternatively, you can choose to use the pommed-lightAUR package. If you do so, you may wish to change the step settings in /etc/pommed.conf.mactel
to something around 5000-10000 depending on how many levels of brightness you desire (the max brightness is around 80000).
If the brightness does not function correctly through pommed, make sure you have installed the nvidia-bl-dkmsAUR package and insert
find . -name "*" -exec sed -i 's/mbp_backlight/nvidia_backlight/' '{}' \;
into the second line of the pommed PKGBUILD build() function and rebuild the package. See the following forum post for details.
Another possible solution is:
find . -name "*" -exec sed -i 's/nvidia_backlight/apple_backlight/' '{}' \;
Alternatively, run nvidia-settings, edit /etc/X11/xorg.conf
and add this line into the Device
section:
Option "RegistryDwords" "EnableBrightnessControl=1"
Save, reboot and check if the backlight control works. See Ubuntu's Wiki page for the MacBookPro5,5 for details.
iMac 2020 (with AMDGPU and 5k retina resolution)
It seems amdgpu driver has problems to set the native 5k resolution. If the display gets corrupted during boot when amdgpu driver module is loaded, try forcing a lower resolution. Add e.g. video=2560x1440@60
to your kernel parameters.
Touchpad
The touchpad should have basic functionality by default. A true multitouch driver which behaves very similarly to native macOS is included in the xf86-input-mtrack-gitAUR package. Configuration options are documented in the readme.
The following mtrack options work well on a MacBook7,1:
Option "Thumbsize" "50" Option "ScrollDistance" "100"
Probably, you also need to add:
MatchDevicePath "/dev/input/event10"
To disable tap-to-click (that is, to press down to click) by default, add the following to your mtrack configuration section
Option "TapButton1" "0" Option "TapButton2" "0" Option "TapButton3" "0"
Natural scrolling
To configure natural two finger scrolling similar to macOS, refer to Touchpad Synaptics#Natural scrolling.
If you are using xf86-input-mtrack-gitAUR, you can simply swap the scroll up and scroll down buttons (along with the scroll left and scroll right):
/etc/X11/xorg.conf.d/10-mtrack.conf
... Option "ScrollUpButton" "5" Option "ScrollDownButton" "4" Option "ScrollLeftButton" "7" Option "ScrollRightButton" "6" ...
Older MacBook models
On older MacBook models (pre-multitouch, e.g. MacBook2,1), the touchpad will not function properly until you install xf86-input-synaptics. See Touchpad Synaptics for details.
Keyboard
Mac keyboards work by default. For swapping Fn
keys with Fx
keys see Apple Keyboard.
Map them with xbindkeys or through desktop environment preferences. Alternatively, install the pommed-lightAUR package.
Edit the /etc/pommed.conf
according to your hardware, building it from /etc/pommed.conf.mac
or /etc/pommed.conf.ppc
example files.
Note that you can also run it without a configuration file, the defaults may work for you. Then enable/start pommed.service
.
Keyboard backlight
The keyboard backlight is controlled by /sys/class/leds/smc::kbd_backlight
. Write the desired value to brightness
in that directory.
Both acpilight or kbdlightAUR (stalled since 2015) allow to control keyboard backlight though scripts. With the appropriate udev rules or sxhkd they allow light-level changes without being root.
Alternatively you might want to check out the Keyboard backlight wiki page.
Ensuring the keyboard backlight is on when entering the LUKS decryption password
This can be done via initcpio hooks. First, create an executable install script:
/etc/initcpio/install/mac_kb_backlight
#!/usr/bin/env bash build() { add_module applesmc add_runscript }
Next, create an executable hook:
/etc/initcpio/hooks/mac_kb_backlight
#!/usr/bin/env bash run_hook() { if [ -f "/sys/class/leds/smc::kbd_backlight/brightness" ]; then echo 100 > "/sys/class/leds/smc::kbd_backlight/brightness" fi }
Finally, add this custom hook to the HOOKS
array in /etc/mkinitcpio.conf
, and ensure it is placed before the encrypt
hook:
HOOKS=(... mac_kb_backlight encrypt ...)
Remember to regenerate the initramfs images after these steps to include the custom script.
Wi-Fi
Different Mac models have different wireless cards.
You can easily check what card you have:
# lspci | grep Network
- If you have an Atheros card, all should work out-of-the-box.
- If you have a Broadcom card, follow Broadcom wireless#Installation.
- 5.0 and 6.0 generation Macs may have a BCM43xx, follow Broadcom wireless#broadcom-wl.
- If you have the correct Broadcom DKMS driver (i.e. broadcom-wl-dkms) installed and your WiFi card is still not being recognized, try rebuilding the driver (See Dynamic Kernel Module Support).
- If your connection frequently drops, you may have to turn off Wi-Fi power management.
- Eduroam or similar may crash your network manager. Simply delaying the connection after login should do the trick.
Fan Control
macfand-gitAUR is a fan control daemon that supports most Intel Macs, its configuration file is located at /etc/macfand.conf
.
mbpfan-gitAUR is available for MacBook Pro users.
Power management
Powerdown is a very simple to set up set of scripts what will maximize your battery duration. A MacBook Air 2013 with powerdown provides about 11 hours of light usage with just powerdown installed. All the usual power management recomendations apply as well.
Disabling Thunderbolt
Linux still has poor power management for Thunderbolt adapters on Macs. This can cause the TB adapter(s) to be always-on and prevent the CPU from going into the deepest power-saving states [1], drawing ca. 2W additional power even when not in use [2]. An easy way to see the CPU states is using powertop. The problem arises when the CPU does not go below C3 as a package (Pkg%pc3).
One workaround is to add acpi_osi=!Darwin
to the kernel parameters, thereby telling the firmware that the system is not compatible with macOS [3]. This should disable the TB adapter (at least on older Macs), and thus reduce power consumption greatly, but will probably come with side-effects (e.g. no Thunderbolt, maybe others?).
It is also possible to blacklist the thunderbolt module and then putting the controllers to sleep with
# echo auto > /sys/bus/pci/devices/0000:07:00.0/power/control
Check the correct device number with lspci. This can also be automated. This method reduces power consumption slightly, but still consumes 0.9 W more than the previous method on a MacBook Air 2013.
Suspend and hibernate
Issues were reported where the machine would "suspend immediately after resume" in certain conditions when suspending by closing the lid. This was solved by setting the option "sleep-inactive-ac-type" to "nothing" using dconf-editor, option path: org → gnome → settings-daemon → plugins → power).
See Suspend and hibernate for details on how to configure hibernation. Noticeably, you will need a swap partition or file (see the mentioned article for further instructions).
Slow wake ups from a suspend state can be resolved by disabling Thunderbolt. See #Disabling Thunderbolt.
Wake up after suspend
Occasionally a Mac laptop may wake up immediately after suspending. This may not be immediately evident as the screen may stay off despite the system being awake, and can be checked by seeing whether the keyboard backlight stays on.
In /proc/acpi/wakeup
, check to see that XHC1 and LID0 are enabled. If they are, one can temporarily disable just LID0 with the following to see if the issue resolves
# echo XHC1 > /proc/acpi/wakeup
To make the change persistent, create:
/etc/systemd/system/suspend-fix.service
[Unit] Description=Fix for the suspend issue [Service] Type=oneshot ExecStart=/bin/sh -c "echo LID0 > /proc/acpi/wakeup" [Install] WantedBy=multi-user.target
And then enable/start suspend-fix.service
. To wake the system from this point, use the keyboard.
If this doesn't resolve the issue, XHC1 may be the issue and one can disable both it and LID0 temporarily with the following to see if it goes away.
# echo XHC1 > /proc/acpi/wakeup && echo LID0 > /proc/acpi/wakeup
Disabling only XHC1 is not recommended if you have this bug, since it may result in glitchy behavior. Disable both on every boot as follows:
/etc/systemd/system/suspend-fix.service
[Unit] Description=Fix for the suspend issue [Service] Type=oneshot ExecStart=/bin/sh -c "echo XHC1 > /proc/acpi/wakeup && echo LID0 > /proc/acpi/wakeup" [Install] WantedBy=multi-user.target
To wake the system from this point, only the power button can be used.
Light sensor
The values can be read from /sys/devices/platform/applesmc.768/light
: it returns two-tuples like (4,0).
If you want to use the built in light sensor to automatically adjust screen and keyboard backlight brightness:
- Lighter — A simple perl script, easy to fine-tune. Ignores the second value - which always seems to be 0 - and uses the first number as measured environment lighting brightness value.
- https://github.com/Janhouse/lighter || not packaged? search in AUR
- Lightum — Requires Gnome or KDE but is older and more complete than Lighter
Sound
First of all follow ALSA wiki page, then if something does not work correctly, continue reading this part.
Kernel options
Edit your /etc/modprobe.d/50-sound.conf
or /etc/modprobe.d/modprobe.conf
appending this line:
options snd_hda_intel model=intel-mac-auto
This should automatically specify the codec in your Mac.
/etc/modprobe.d
, test it by rebooting.Specific models may need more help. You can try specifying other options according to your hardware. All possible settings are listed in Kernel Documentation, available online:
- Advanced Linux Sound Architecture - Driver Configuration guide
- HD-Audio
- HD-Audio Codec-Specific Models
Model-specifics
For example, if you have a MacBookPro12,1, you might need
options snd-hda-intel index=1,0
instead. Alternatively, for MacBookPro5,X, you can use:
options snd_hda_intel model=mb5
(note that the jack output is controlled with "HP").
If you have an iMac8,1, you should instead use
options snd-hda-intel model=mbp3 position_fix=2
For Aluminium iMacs, see iMac Aluminium#Getting sound to work right
For MacBook2,1 (late 2008/early 2009)s with a SigmaTel STAC9221 A1 chip, use
options snd_hda_intel model=macbook
Disabling S/PDIF
Some (most?) Mac models have an optical S/PDIF audio jack in the same jack as the headphone jack. You can see it when it is active as a red light glowing out of the headphone jack. It can trick PulseAudio into preferring it and routing all your audio out it.
If you are not getting any sound in or out, confirm that pavucontrol
> Configuration > Profile says "Analog Stereo Duplex" instead of "Digital"
or just run
$ pacmd set-card-profile 0 output:analog-stereo+input:analog-stereo
Also check if you need to edit /usr/share/alsa-card-profile/mixer/paths/
to workaround faulty plug detection causing PulseAudio to failover to "Digital".
See Laptop/Apple#Microphone for how to edit this to get the MacBook2,1's microphone to work.
Auto-Mute Mode
The internal speaker might not be disabled when using the headphone jack. To solve this, enable "Auto-Mute Mode".
You can either do this using alsamixer
:
- Run
alsamixer
- Press
F6
and pickdefault:0 HDA Intel
to get more detailed controls - Use the arrow keys to select "Auto-Mute Mode"
- Press
Space
to enable it
or with amixer
:
$ amixer -c 0 cset name='Auto-Mute Mode' 1
Optionally, run alsactl store
as root to make the change permanent.
USB audio interface
In some cases, it can actually be easier to set up sound using a USB audio interface rather than the jack directly.
With pavucontrol, go to Configuration
, choose Off
for all devices and choose Analog Stereo Duplex
for your USB device. You can then use the headphone jack on the USB device for speakers or headphones. This should work immediately and on startup.
Bluetooth
Bluetooth should work out-of-the box. See the article on Bluetooth to install and configure all software needed.
Magic Mouse
If you use a magic mouse you will find it works nicely out of the box. You might want to tweak some settings such as scroll-speed or acceleration. There is no GUI for this at this time. The only way to set these settings is to instruct the kernel driver (hid_magicmouse
) with parameters. Create a modprobe config file for your mouse.
/etc/modprobe.d/magicmouse.conf
options hid_magicmouse scroll-speed=55 scroll-acceleration=1 emulate_3button=0
This will instruct the driver to have a fast scroll-speed, do exponential acceleration and do not emulate a 3 button mouse. You can find an overview of all parameters and their current settings in /sys/module/hid_magicmouse/parameters
.
To try different settings without rebooting you can also set them through the command line:
# echo 55 > /sys/module/hid_magicmouse/parameters/scroll_speed
Webcam
iSight
isight-firmware-tools
if it does not work normally.iSight webcams on MacBooks or pre 6,2 MacBook Pros (6,2 came out around 2010) require the Apple's proprietary firmware that cannot be redistributed. It must be extracted from macOS and loaded onto Arch.
There is a pre-extracted copy at https://archive.org/details/macbook-isight-webcam-linux.
If you want to do it yourself you will need to install isight-firmware-toolsAUR to extract the firmware. This package also includes a udev rule and ELF binary that are necessary, even once you have extracted the firmware file into /lib/firmware/isight.fw
, for the file to be loaded every time you boot your computer (namely /etc/udev/rules.d/isight.rules
which uses /usr/lib/udev/ift-load
).
Instructions:
First you need to get the firmware out of a particular file located on your macOS install. It is located in /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport
.
AppleUSBVideoSupport
file from a OS X 10.6 (Snow Leopard) installation may not work properly. If possible, use the file from OS X 10.5 or earlier.To mount the macOS drive if multi-booting:
# mkdir /media/macOS # mount -t hfsplus /dev/sda2 /media/macOS
Then, install the isight-firmware-toolsAUR package.
Locate the AppleUSBVideoSupport
file in the macOS directory listed above. Either copy it over to your Arch system (Any macOS installation should do, such as an iMac, not just one specific to your system) or, if multi-booting, mount the macOS drive and navigate to the directory. (On 10.6 (Snow Leopard) and 10.7 (Lion) the directory is /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS
.) In that directory you can go ahead and extract the driver:
# ift-extract --apple-driver AppleUSBVideoSupport
When it is done, check that the firmware has been found:
# ls /lib/firmware/isight.fw
Once successful, completely shutdown your Mac and start it back up again (to clear the hardware state of the webcam). Do not reboot.
It should be automatically loaded at boot; if it is not you can load the uvcvideo
module manually or load it at boot.
FaceTime HD Camera
Recent Macs include the FaceTime HD Camera, which may be connected by PCIe. You can confirm this by looking for "FaceTime HD Camera" in the output of lspci
. The bcwc-pcie-gitAUR package installs a facetimehd
module (and firmware) to support these devices. The module should be loaded automatically after installation.
If the webcam shows incorrect colors, this may be due to missing sensor calibration files. Instructions for extracting the calibration files from Apple BootCamp drivers are given in this page: https://github.com/patjak/bcwc_pcie/wiki/Extracting-the-sensor-calibration-files
See Multimedia#Webcam for applications with which to test.
Temperature Sensors
For reading temperature just install lm_sensors. See the lm_sensors page for more information.
Avoid long EFI wait before booting
If your Mac spends 30 seconds with "white screen" before booting you need to tell the firmware where the booting partition is.
Boot macOS, if you do not have it installed, you can use the install DVD (select language, then click Utilities->Terminal) or another Mac with macOS (connect the two computers via firewire or thunderbolt, start the other Mac while holding the T button, boot your Mac while holding the Options button (alt)).
Either way, once you have got a macOS terminal running on your Mac you need to execute the following command if the booting partition is EFI:
# bless --device /dev/diskXsY --setBoot
or if the booting partition is not EFI:
# bless --device /dev/diskXsY --setBoot --legacy
See also https://bbs.archlinux.org/viewtopic.php?pid=833215.
kworker using high CPU
Sometime with the addition of Yosemite, some users found that kworker CPU usage will spike, as discussed here. This is sometimes the result of runaway ACPI interrupts.
To check and see, you can count the number of recent ACPI interrupts and see if any of them are out of control.
$ grep . -r /sys/firmware/acpi/interrupts/
If you see that one particular interrupt is out of control (possibly GPE66), i.e., registering hundreds of thousands of lines, you can try disabling it (replace XX with the runaway interrupt):
# echo "disable" > /sys/firmware/acpi/interrupts/gpeXX
Disabling random ACPI interrupts could cause all kinds of problems, so do this at your own risk. If this fixes the problem, there is discussion about how to make a systemd service that automatically disables an interrupt at every boot here.
Mavericks upgrade breaks Arch boot option
For some multi-boot users who utilize a separate Linux boot partition, the OS X Mavericks upgrade may overwrite the boot partition with Apple's own recovery boot filesystem. This breaks the Arch Linux boot option in rEFIt/rEFInd. The best way to proceed in this situation is to abandon a separate boot partition and use the EFI system partition (ESP) to install the boot loader of your choice. It is also recommended that you use rEFInd instead of rEFIt as development on the latter has halted.
Assuming grub2 as the boot loader:
Use the Arch LiveCD to boot to a shell and chroot to your broken Arch Linux environment.
Mount the ESP on /boot.
Edit the fstab and remove the old boot partition and make ESP the new boot partition. Now mount the ESP as the new /boot
parition.
# mount -a
Create a new initramfs and vmlinuz in /boot.
# mkinitcpio -p linux
Install grub.
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck --debug
Create a new grub.cfg file.
# grub-mkconfig -o /boot/EFI/grub/grub.cfg
Make sure that grub.cfg is in the same directory as grubx64.efi.
Generate a new refind_linux.conf file in /boot simply by running mkrlconf.sh which comes with rEFInd.
Exit the chroot environment.
Reboot. You should see a new entry for Arch Linux in rEFInd and it should boot to your Arch Linux installation.
See also
- https://wiki.t2linux.org/
- MacBook Air
- MacBook Pro