Created
February 21, 2026 07:29
-
-
Save fourcolors/bed44786a91092e9f521a082472f63ef to your computer and use it in GitHub Desktop.
Arch Linux T2 installer for 2019 MacBook Pro + Omarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ============================================================================= | |
| # Arch Linux T2 Mac Installer + Omarchy Setup | |
| # For: 2019 MacBook Pro (T2 chip) | |
| # Run from: archlinux-t2 live USB | |
| # | |
| # Usage: curl -sL <gist-url> | bash | |
| # Or: bash arch-t2-install.sh | |
| # ============================================================================= | |
| set -euo pipefail | |
| DISK="/dev/nvme0n1" | |
| EFI_SIZE="512M" | |
| SWAP_SIZE="16G" | |
| HOSTNAME="macbook" | |
| USERNAME="cobb" | |
| TIMEZONE="America/Chicago" | |
| RED='\033[0;31m' | |
| GREEN='\033[0;32m' | |
| YELLOW='\033[1;33m' | |
| CYAN='\033[0;36m' | |
| NC='\033[0m' | |
| info() { echo -e "${GREEN}[*]${NC} $1"; } | |
| warn() { echo -e "${YELLOW}[!]${NC} $1"; } | |
| err() { echo -e "${RED}[✗]${NC} $1"; } | |
| step() { echo -e "\n${CYAN}=== $1 ===${NC}\n"; } | |
| # --------------------------------------------------------------------------- | |
| # Pre-flight checks | |
| # --------------------------------------------------------------------------- | |
| step "Pre-flight Checks" | |
| if [ "$(id -u)" -ne 0 ]; then | |
| err "Run this script as root" | |
| exit 1 | |
| fi | |
| if [ ! -b "$DISK" ]; then | |
| err "${DISK} not found. Available disks:" | |
| lsblk -d -o NAME,SIZE,MODEL | |
| echo "" | |
| read -rp "Enter disk path (e.g. /dev/sda): " DISK | |
| if [ ! -b "$DISK" ]; then | |
| err "${DISK} not found. Aborting." | |
| exit 1 | |
| fi | |
| fi | |
| # Detect partition suffix (nvme uses p1, sda uses 1) | |
| if [[ "$DISK" == *"nvme"* ]]; then | |
| PART="${DISK}p" | |
| else | |
| PART="${DISK}" | |
| fi | |
| info "Target disk: ${DISK}" | |
| info "Partitions: EFI=${EFI_SIZE} Swap=${SWAP_SIZE} Root=remaining" | |
| info "Hostname: ${HOSTNAME}" | |
| info "User: ${USERNAME}" | |
| echo "" | |
| lsblk "$DISK" | |
| echo "" | |
| echo -e "${RED}WARNING: This will ERASE ALL DATA on ${DISK}${NC}" | |
| read -rp "Type 'YES' to continue: " confirm | |
| if [ "$confirm" != "YES" ]; then | |
| echo "Aborted." | |
| exit 0 | |
| fi | |
| # --------------------------------------------------------------------------- | |
| # 1. Partition | |
| # --------------------------------------------------------------------------- | |
| step "1/9 — Partitioning ${DISK}" | |
| sgdisk --zap-all "$DISK" | |
| sgdisk --new=1:0:+"${EFI_SIZE}" --typecode=1:ef00 --change-name=1:"EFI" "$DISK" | |
| sgdisk --new=2:0:+"${SWAP_SIZE}" --typecode=2:8200 --change-name=2:"swap" "$DISK" | |
| sgdisk --new=3:0:0 --typecode=3:8300 --change-name=3:"root" "$DISK" | |
| partprobe "$DISK" | |
| sleep 2 | |
| info "Partition table:" | |
| sgdisk -p "$DISK" | |
| # --------------------------------------------------------------------------- | |
| # 2. Format | |
| # --------------------------------------------------------------------------- | |
| step "2/9 — Formatting" | |
| mkfs.fat -F32 "${PART}1" | |
| info "EFI formatted (FAT32)" | |
| mkswap "${PART}2" | |
| info "Swap formatted" | |
| mkfs.btrfs -f "${PART}3" | |
| info "Root formatted (btrfs)" | |
| # --------------------------------------------------------------------------- | |
| # 3. Mount | |
| # --------------------------------------------------------------------------- | |
| step "3/9 — Mounting" | |
| mount "${PART}3" /mnt | |
| # Create btrfs subvolumes for better snapshot support | |
| btrfs subvolume create /mnt/@ | |
| btrfs subvolume create /mnt/@home | |
| umount /mnt | |
| mount -o noatime,compress=zstd,subvol=@ "${PART}3" /mnt | |
| mkdir -p /mnt/{boot,home} | |
| mount -o noatime,compress=zstd,subvol=@home "${PART}3" /mnt/home | |
| mount "${PART}1" /mnt/boot | |
| swapon "${PART}2" | |
| info "Mounted: root=@ home=@home boot=EFI swap=on" | |
| # --------------------------------------------------------------------------- | |
| # 4. Configure T2 repo (live environment) | |
| # --------------------------------------------------------------------------- | |
| step "4/9 — Configuring T2 Repository" | |
| if ! grep -q "arch-mact2" /etc/pacman.conf 2>/dev/null; then | |
| cat >> /etc/pacman.conf << 'EOF' | |
| [arch-mact2] | |
| Server = https://mirror.funami.tech/arch-mact2/os/x86_64 | |
| SigLevel = Never | |
| EOF | |
| info "Added arch-mact2 repo to live environment" | |
| else | |
| info "arch-mact2 repo already configured" | |
| fi | |
| pacman -Sy --noconfirm | |
| # --------------------------------------------------------------------------- | |
| # 5. Install base system | |
| # --------------------------------------------------------------------------- | |
| step "5/9 — Installing Base System (this takes a while)" | |
| pacstrap -K /mnt \ | |
| base linux-t2 linux-t2-headers linux-firmware \ | |
| base-devel \ | |
| networkmanager iwd wireless_tools wpa_supplicant \ | |
| apple-bcm-firmware \ | |
| btrfs-progs efibootmgr dosfstools \ | |
| grub \ | |
| git vim nano sudo man-db \ | |
| bluez bluez-utils \ | |
| pipewire pipewire-alsa pipewire-pulse wireplumber \ | |
| zsh wget curl unzip | |
| # T2 hardware packages (may fail if repo is unavailable, non-fatal) | |
| pacstrap -K /mnt apple-t2-audio-config t2fanrd tiny-dfr 2>/dev/null || \ | |
| warn "Some T2 packages not available — install manually after boot" | |
| info "Base system installed" | |
| # --------------------------------------------------------------------------- | |
| # 6. Generate fstab | |
| # --------------------------------------------------------------------------- | |
| step "6/9 — Generating fstab" | |
| genfstab -U /mnt >> /mnt/etc/fstab | |
| info "fstab generated:" | |
| cat /mnt/etc/fstab | |
| # --------------------------------------------------------------------------- | |
| # 7. Add T2 repo to installed system | |
| # --------------------------------------------------------------------------- | |
| step "7/9 — Configuring Installed System" | |
| cat >> /mnt/etc/pacman.conf << 'EOF' | |
| [arch-mact2] | |
| Server = https://mirror.funami.tech/arch-mact2/os/x86_64 | |
| SigLevel = Never | |
| EOF | |
| info "T2 repo added to installed system" | |
| # --------------------------------------------------------------------------- | |
| # 8. Chroot configuration | |
| # --------------------------------------------------------------------------- | |
| step "8/9 — System Configuration (chroot)" | |
| arch-chroot /mnt /bin/bash << CHROOTEOF | |
| set -e | |
| # Timezone | |
| ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime | |
| hwclock --systohc | |
| echo "Timezone set to ${TIMEZONE}" | |
| # Locale | |
| echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen | |
| locale-gen | |
| echo "LANG=en_US.UTF-8" > /etc/locale.conf | |
| # Hostname | |
| echo "${HOSTNAME}" > /etc/hostname | |
| cat > /etc/hosts << HOSTS | |
| 127.0.0.1 localhost | |
| ::1 localhost | |
| 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME} | |
| HOSTS | |
| # T2 kernel modules for initramfs | |
| sed -i 's/^MODULES=.*/MODULES=(btrfs apple_bce hid_apple usbhid xhci_hcd)/' /etc/mkinitcpio.conf | |
| mkinitcpio -P | |
| # Bootloader | |
| grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable | |
| grub-mkconfig -o /boot/grub/grub.cfg | |
| # Enable services | |
| systemctl enable NetworkManager | |
| systemctl enable bluetooth | |
| systemctl enable t2fanrd 2>/dev/null || true | |
| # Create user | |
| useradd -m -G wheel,audio,video,input -s /bin/zsh ${USERNAME} | |
| echo "${USERNAME}:changeme" | chpasswd | |
| echo "root:changeme" | chpasswd | |
| echo "%wheel ALL=(ALL:ALL) ALL" >> /etc/sudoers | |
| # WiFi power management off (helps T2 Broadcom) | |
| mkdir -p /etc/NetworkManager/conf.d | |
| cat > /etc/NetworkManager/conf.d/wifi-powersave.conf << NMCONF | |
| [connection] | |
| wifi.powersave = 2 | |
| NMCONF | |
| echo "Chroot configuration complete" | |
| CHROOTEOF | |
| info "System configured" | |
| # --------------------------------------------------------------------------- | |
| # 9. Post-install notes | |
| # --------------------------------------------------------------------------- | |
| step "9/9 — Done!" | |
| cat << 'DONE' | |
| ┌─────────────────────────────────────────────────┐ | |
| │ Installation Complete! │ | |
| │ │ | |
| │ User: cobb │ | |
| │ Password: changeme (CHANGE THIS!) │ | |
| │ Root pw: changeme (CHANGE THIS!) │ | |
| └─────────────────────────────────────────────────┘ | |
| Next steps: | |
| 1. umount -R /mnt && reboot | |
| 2. Remove USB, hold Option key, select GRUB | |
| 3. Login as 'cobb', connect to WiFi: | |
| nmtui | |
| 4. Change your passwords: | |
| passwd | |
| sudo passwd root | |
| 5. Install Omarchy: | |
| git clone https://github.com/basecamp/omarchy.git ~/.omarchy | |
| cd ~/.omarchy | |
| # Review install scripts, then: | |
| # ./install.sh (or follow their README) | |
| 6. If WiFi doesn't work: | |
| sudo rfkill unblock all | |
| sudo modprobe brcmfmac | |
| DONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment