Skip to content

Instantly share code, notes, and snippets.

@OctavioBR
Last active November 28, 2021 22:45
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OctavioBR/5992416015d73253e92929d9c8be8cb4 to your computer and use it in GitHub Desktop.
Save OctavioBR/5992416015d73253e92929d9c8be8cb4 to your computer and use it in GitHub Desktop.

Arch Install for Macbook Pro

Macbook Pro Retina 15-inch, Late 2013
Model Identifier: MacBookPro11,2

The MacBook Pro 11,x consists of models with Retina display shipped by Apple In Late 2013 and Mid 2014.
Following ArchWiki guide.

Steps for OS installation

Grab a cup of coffe and get ready, because life is not always easy 🙈

Assets

  • OSX backup
  • USB drive with Arch Linux ISO
  • USB drive with macOS Sierra
  • Ethernet to USB adapter

1. First boot into virtual console

Increase system font with:
setfont sun12x22

Verify UEFI is enabled by:
ls /sys/firmware/efi/efivars

Test internet connection:
ping archlinux.org
(can try to reconnect with dhcpcd)

Turn NTP on:
timedatectl set-ntp true

2. Partition Scheme

fdisk -l
------------------------------------------
/dev/sda    233.8GB
/dev/sda1   200M        EFI System (/boot)
/dev/sda2   157.6GB     macOS
/dev/sda2   619.9M      Apple Recovery
/dev/sda4   75.2GB      Arch Linux (/)
------------------------------------------
fdisk /dev/sda

(d, n then w operations)

3. Mount the file systems

mount /dev/sda4 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

4. Configure mirror list

/etc/pacman.d/mirrorlist

5. Install base packages

update /etc/pacman.d/gnupg/gpg.conf
with keyserver hkp://pgp.mit.edu:11371
then pacman-key --populate archlinux and pacman-key --refresh-keys
then finnaly: pacstrap -i /mnt base base-devel

6. Create swap file

fallocate -l 4G /mnt/swapfile
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
vim /etc/fstab > `/swapfile none swap defaults 0 0`

7. Generate Fstab

genfstab -U /mnt >> /mnt/etc/fstab
adjust swapfile path (without /mnt) and improve SSD:
vim /mnt/etc/fstab
Make sure that the line of the ext4 partition ends with a “2”, the swap partition’s line ends with a “0”, and the boot partition’s line ends with a “1”. This configures the partition checking on boot.
If you want to optimise your fstab for an SSD you can edit the ext4 partition options to look like this:
rw,relatime,data=ordered,discard

[TODO] put fstab example content here

8. Change root into the new system

arch-chroot /mnt

9. Set time zone

ln -sf /usr/share/zoneinfo/Brazil/East /etc/localtime
Run hwclock(8) to generate /etc/adjtime:
hwclock --systohc

10. Locale

Uncomment en_US.UTF-8 UTF-8 pt_BR.UTF-8 and other needed localizations in /etc/locale.gen, and generate them with:
locale-gen

Set the LANG variable in locale.conf(5) accordingly, for example:
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
set preferred keymap with (see available with localectl list-keymaps)
echo "KEYMAP=us" >> /etc/vconsole.conf

11. Set machine hostname

echo "arch-mac" > /etc/hostname
and add matching entries to /etc/hosts
127.0.1.1 arch-mac.localdomain arch-mac

Note: "arch-mac" should be replaced by your preference

12. Set root password

passwd

13. Mac kernel modules

nano /etc/modules
insert two lines:
coretemp
applesmc

14. Configure boot loader

Use systemd-boot.
Once inside the chrooted enviroment, type the following command to install systemd-boot:
(make sure you mounted the EFI System Partition at /boot)
bootctl --path=/boot install

nano /boot/loader/entries/arch.conf

title Arch Linux
linux /vmlinuz-linux
initrd  /intel-ucode.img
initrd /initramfs-linux.img
options root=/dev/sda4 rw elevator=deadline quiet splash

15. Intel microcode

pacman -S intel-ucode check if /boot/intel-ucode.img is in ESP

17. REBOOT!

Finally you may have a working Arch Linux install 🙏

Basic system management & general recommendations

Because our system is not yet pleasantly usable 😄

Bigger vconsole font

To persist the biggest virtual console font:

pacman -S terminus-font
setfont ter-132n
echo "FONT=ter-132n" > /etc/vconsole.conf

Other interesting fonts.

Network configuration

Opted to use automatic setup with NetworkManager.

Wi-Fi driver

Download broadcom driver

curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/broadcom-wl.tar.gz
tar -xvf briadcom-wl.tar.gz
makepkg -si

WPA configuration

pacman -S iw wpa_supplicant dialog

Can test with ip link set wlp2s0 up or wifi-menu.

NetworkManager

Let's disable netctl first: netctl stop-all and systemctl disable netctl then

pacman -S networkmanager dhclient
systemctl enable NetworkManager && systemctl start NetworkManager
nmtui

[TODO] show cyrillic SSIDs

Create personal user

useradd -m -G wheel -s /bin/bash octavio
Edit sudoers file to enable running sudo (opitionaly without password)
visudo

Cooling fans

Opted to use mbpfan daemon. It is very versatile.
[TODO] pacman install command

Configure daemon in file /etc/mbpfan.conf:
Set min_fan_speed with the lowest value of cat /sys/devices/platform/applesmc.768/fan*_min (I personally put a little higher)
Set max_fan_speed as the highest value of cat /sys/devices/platform/applesmc.768/fan*_max
Set max_temp taking highest number returned by cat /sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_max, divide by 1000.
In my case I use:

  • min_fan_speed: 2160
  • max_fan_speed: 5700
  • low_temp: 52
  • high_temp: 58
  • max_temp: 84
  • polling_interval: 7

X.org configuration and Intel video drivers

Install xorg with:
pacman -S xorg xorg-twm xorg-xclock xterm or just xorg-server xorg-apps - (installs lots of packages)
and intel drivers:
pacman -S mesa vulkan-intel xf86-video-intel intel-dri - (still studying if one should use more than vesa)

To configure xorg manually, write in /etc/X11/xorg.conf.d/10-intel.conf

Section "Device"
    Identifier  "Intel Graphics"
    Driver      "intel"
    Option      "DRI" "2"
    Option      "AccelMethod" "sna"
    Option "TearFree" "true"
EndSection

and inside /etc/X11/xorg.conf.d/11-monitor.conf

Section "Monitor"
    Identifier             "Monitor0"
EndSection

Section "Device"
    Identifier             "Device0"
    Driver                 "intel"
EndSection

Section "Screen"
    Identifier             "Screen0"  #Collapse Monitor and Device section to Screen section
    Device                 "Device0"
    Monitor                "Monitor0"
    DefaultDepth           24
    SubSection             "Display"
        Depth              24
        Modes              "2880x1800_75.00"
    EndSubSection
EndSection

Setup window manager (i3)

pacman -S i3

Installs i3-wm, i3blocks, i3lock, and i3status

https://i3wm.org/docs/userguide.html

Utility packages

pacman -S the following:

  • tree
  • zsh
    • chsh -s $(which zsh)
  • wget
  • go
  • git

AUR & pacman helpers

Opted to use yay.

rEFInd setup

[TODO]

Custom boot icon

Alternatively to rEFInd, you can set native's apple boot manager with custom icons:

pacman -S wget librsvg
install libicns(AUR)
wget -O /tmp/archlinux.svg https://www.archlinux.org/logos/archlinux-icon-crystal-64.svg
rsvg-convert -w 128 -h 128 -o /tmp/archlogo.png /tmp/archlinux.svg
sudo png2icns /boot/.VolumeIcon.icns /tmp/archlogo.png
rm /tmp/archlogo.png
rm /tmp/archlinux.svg

HiDPI

[TODO]

Sound

[TODO]

Touchpad

[TODO]

Keyboard backlight & ctrl-fn-alt order layout

Install linux-macbook(AUR) [TODO]

@dortamiguel
Copy link

Awesome!!

@ryukinix
Copy link

Go back, man. Go back to X.org FORCE

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