Skip to content

Instantly share code, notes, and snippets.

@vineyardbovines
Last active July 21, 2025 05:40
Show Gist options
  • Select an option

  • Save vineyardbovines/149e8ebe7a8f317cc687f82c1aacf1a0 to your computer and use it in GitHub Desktop.

Select an option

Save vineyardbovines/149e8ebe7a8f317cc687f82c1aacf1a0 to your computer and use it in GitHub Desktop.

Revisions

  1. @Gretzky Gretzky revised this gist Apr 21, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions macOS x arch linux
    Original file line number Diff line number Diff line change
    @@ -225,8 +225,6 @@ swapoff -a
    reboot

    # after reboot, you should be brought to the rEFInd menu
    # select the linux penguin, and you then should be brought
    # to GRUB. select the second option (fallback initramfs)

    #######
    step 12. (arch) - last configurations
  2. @Gretzky Gretzky revised this gist Apr 21, 2021. No changes.
  3. @Gretzky Gretzky revised this gist May 22, 2018. 1 changed file with 3 additions and 25 deletions.
    28 changes: 3 additions & 25 deletions macOS x arch linux
    Original file line number Diff line number Diff line change
    @@ -115,7 +115,6 @@ cgdisk /dev/sda
    # create the following partitions from the free space:
    (size, name, hex)

    - 100m, efi, ef00
    - 128m, linux boot loader, 8300
    - 8g, swap, 8200
    - 256m, boot, 8300
    @@ -131,9 +130,6 @@ step 7. (arch USB) - format partitions

    run `fdisk -l` to know each disk number (/dev/sdX).

    # for efi:
    mkfs.vat -F32 /dev/sdX

    # for boot:
    mkfs.ext2 /dev/sdX

    @@ -148,16 +144,11 @@ swapon /dev/sdX
    step 8. (arch USB) - mount filesystems
    ######

    *NOTE*: when we mount the efi partition, we're mounting the 100m
    one we created, NOT the 200m one automatically created by macOS
    (usually /dev/sda1). leave that one alone. you've been warned.

    # first, mount the root partition:
    mount /dev/sdX /mnt

    # mount the rest (order matters):
    mkdir /mnt/boot && mount /dev/sdX /mnt/boot
    mkdir /mnt/boot/efi && mount /dev/sdX /mnt/boot/efi
    mkdir /mnt/var && mount /dev/sdX /mnt/var
    mkdir /mnt/home && mount /dev/sdX /mnt/home

    @@ -166,7 +157,7 @@ step 9. (arch USB) - install arch and extra packages needed
    ######

    # install arch & extras (vim and zsh not necessary):
    pacstrap /mnt base base-devel zsh vim git grub-efi-x86_64 efibootmgr dialog wpa_supplicant
    pacstrap /mnt base base-devel zsh vim git efibootmgr dialog wpa_supplicant

    # set fstab to record filesystem settings:
    genfstab -p /mnt >> /mnt/etc/dstab
    @@ -220,20 +211,7 @@ export LANG=en_US.UTF-8
    mkinitcpio -p linux

    #######
    step 11. (arch USB) - install grub
    #######

    # find the ESP number, probably /dev/sda1
    parted /dev/sda print

    # install grub
    grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

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

    #######
    step 12. (arch USB) - finishing off
    step 11. (arch USB) - finishing off
    #######

    # exit the new system
    @@ -251,7 +229,7 @@ reboot
    # to GRUB. select the second option (fallback initramfs)

    #######
    step 13. (arch) - last configurations
    step 12. (arch) - last configurations
    #######

    # login as root
  4. @Gretzky Gretzky revised this gist May 22, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions macOS x arch linux
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ###################################
    #####################################################
    # dual booting arch linux & macOS
    # on a macbook pro 12,1
    # ft. rEFInd
    @@ -12,7 +12,7 @@
    #
    # for each major step, i've denoted where you should
    # be booted to in order to complete the step
    ###################################
    #####################################################


    ######
  5. @Gretzky Gretzky created this gist May 21, 2018.
    292 changes: 292 additions & 0 deletions macOS x arch linux
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,292 @@
    ###################################
    # dual booting arch linux & macOS
    # on a macbook pro 12,1
    # ft. rEFInd
    #
    # this guide has been smashed together from a variety
    # of other awesome guides out there for dual booting
    # including but not limited to:
    # mark nichols' 5 part guide: https://zanshin.net/2015/02/05/arch-linux-on-a-macbook-pro-part-1-creating-a-usb-installer/
    # the arch linux docs: https://wiki.archlinux.org/index.php/mac#Arch_Linux_with_OS_X_or_other_operating_systems
    # jonathan yantis' crazy insta-arch scripts: https://github.com/yantis/instant-archlinux-on-mac
    #
    # for each major step, i've denoted where you should
    # be booted to in order to complete the step
    ###################################


    ######
    step 1. (macOS) - install arch linux to bootable USB
    ######

    # download an ISO of arch (https://www.archlinux.org/download/)
    # convert the ISO to UDRW format
    hdiutil convert -format UDRW -o destination_file.img source_file.iso

    # if you prefer a GUI, i recommend Etcher (https://etcher.io/)

    # otherwise...

    # format the USB
    - run `diskutil list` and find the identifier for your USB (/dev/diskX)
    - erase the USB completely
    - run `diskutil partitionDisk /dev/diskX 1 "Free Space" "unused" "100%"

    # copy the iso to usb:
    dd if=destination_file.img of/dev/diskX bs=1m

    # if you had an issue with the filetype you created (the `.img.dmg`),
    # you can remove `.dmg` from the filename.

    # eject the drive
    diskutil eject /dev/diskX

    ######
    step 2. (macOS) - partition disk
    ######

    # set aside a partition for arch linux in disk utility.
    # make sure the new partition is any filesystem type except APFS.

    # you'll be erasing this anyway.

    ######
    step 3. (macOS) - install rEFInd
    ######

    # at this point, plugin your the USB stick with arch you created.

    # get rEFInd here: https://sourceforge.net/projects/refind/files/latest/download

    # unzip and install rEFInd by running ./refind-install in the directory

    # verify it works by restarting. you should be immediately brought to the
    # rEFInd menu. from there, boot into your USB.

    ######
    step 3a. OPTIONAL (macOS) - configure rEFInd

    # in order to configure rEFInd, we have to edit the refind.conf

    # mount the EFI partition and go to it
    sudo mount -t msdos /dev/disk0s1 /Volumes
    cd /Volumes/EFI/rEFInd

    # download your chosen theme with git
    # in this case, i chose rEFInd-minimal
    git clone https://github.com/EvanPurkhiser/rEFInd-minimal

    # add the theme to refind.conf
    echo "include rEFInd-minimal/theme.conf" >> refind.conf

    # change the icon paths in refind.conf
    vi refind.conf
    # locate the menuentry configs and change the path after icon
    # for arch linux: /EFI/refind/themes/rEFInd-minimal/icons/os_arch.png
    # for macOS: /EFI/refind/themes/rEFInd-minimal/icons/os_mac.png

    ######
    step 5. (arch USB) get connected
    ######

    # we need to be connected to the internet to install arch.
    # newer macbooks ditched ethernet ports, so unless you have a dongle,
    # we need to connect to wifi.
    wifi-menu

    # give it about ~2 mins. check it if works
    ping -c 3 google.com

    ######
    step 6. (arch USB) create partitions
    ######

    # we have to split our linux partition further for arch.

    # look for your new partition.
    cgdisk /dev/sda

    # to distinguish it from your macOS partition, it's the one that IS NOT
    # called 'Untitled'. Your macOS partition is usually /dev/sda2.

    # once you know you have the right partition selected, delete it. it should
    # now just be free space.

    # create the following partitions from the free space:
    (size, name, hex)

    - 100m, efi, ef00
    - 128m, linux boot loader, 8300
    - 8g, swap, 8200
    - 256m, boot, 8300
    - 40g, root, 8300
    - 12g, var, 8300
    - the rest, home, 8300

    # once you're done, hit 'write'.

    ######
    step 7. (arch USB) - format partitions
    ######

    run `fdisk -l` to know each disk number (/dev/sdX).

    # for efi:
    mkfs.vat -F32 /dev/sdX

    # for boot:
    mkfs.ext2 /dev/sdX

    # for the rest (root, var, home):
    mkfs.ex4 /dev/sdX

    # for swap:
    mkswap /dev/sdX
    swapon /dev/sdX

    ######
    step 8. (arch USB) - mount filesystems
    ######

    *NOTE*: when we mount the efi partition, we're mounting the 100m
    one we created, NOT the 200m one automatically created by macOS
    (usually /dev/sda1). leave that one alone. you've been warned.

    # first, mount the root partition:
    mount /dev/sdX /mnt

    # mount the rest (order matters):
    mkdir /mnt/boot && mount /dev/sdX /mnt/boot
    mkdir /mnt/boot/efi && mount /dev/sdX /mnt/boot/efi
    mkdir /mnt/var && mount /dev/sdX /mnt/var
    mkdir /mnt/home && mount /dev/sdX /mnt/home

    ######
    step 9. (arch USB) - install arch and extra packages needed
    ######

    # install arch & extras (vim and zsh not necessary):
    pacstrap /mnt base base-devel zsh vim git grub-efi-x86_64 efibootmgr dialog wpa_supplicant

    # set fstab to record filesystem settings:
    genfstab -p /mnt >> /mnt/etc/dstab

    #######
    step 10. (arch USB) - set initial arch configs
    #######

    # chroot into the new system:
    arch-chroot /mnt /bin/bash

    # set hostname
    echo MYHOSTNAME > /etc/hostname

    # set timezone
    ln -sf /usr/share/zoneinfo/REGION/CITY /etc/localtime

    # set hardware clock
    hwclock --systohc --utc

    # update locale
    echo LANG=en_US.UTF-8 >> /etc/locale.conf
    echo LANGUAGE=en_US >> /etc/locale.conf
    echo LC_ALL=C >> /etc/locale.conf

    # set root password
    passwd

    # add yourself as a user
    # if you don't want zsh, remove the -s flag
    # and change /bin/zsh to /bin/bash
    useradd -m -g users -G wheel -s /bin/zsh MYUSERNAME
    passwd MYUSERNAME

    # allow users to execute commands as sudo
    visudo
    # uncomment the `wheel` line

    # add the locale
    # en_US.UTF-8 is uncommented by default
    # if you need another locale, you can uncomment the
    # one you want- `sudo vi /etc/locale.gen`
    # otherwise, you can just generate the locale
    locale-gen

    # export locale settings
    echo LANG=en_US.UTF8 > /etc/locale.conf
    export LANG=en_US.UTF-8

    # generate initrd
    mkinitcpio -p linux

    #######
    step 11. (arch USB) - install grub
    #######

    # find the ESP number, probably /dev/sda1
    parted /dev/sda print

    # install grub
    grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

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

    #######
    step 12. (arch USB) - finishing off
    #######

    # exit the new system
    exit

    # unmount all partitions
    umount -R /mnt
    swapoff -a

    # reboot into the new system
    reboot

    # after reboot, you should be brought to the rEFInd menu
    # select the linux penguin, and you then should be brought
    # to GRUB. select the second option (fallback initramfs)

    #######
    step 13. (arch) - last configurations
    #######

    # login as root

    # edit modules
    vi /etc/mkinitcpio.conf

    # add ata_piix to the MODULES line

    # save and reboot

    ###########################
    completing the installation
    ###########################

    After reboot, you should be brought to rEFInd. On selecting
    the Linux penguin, you should be brought to GRUB. Select
    the first option, and Arch Linux should start up properly.

    #####################
    further configuration
    #####################

    this next section installs KDE Plasma and i3-gaps
    window manager.

    # install plasma
    sudo pacman -S plasma
    # hit enter to install all default packages

    # install SDDM, plasma recommended desktop manager
    sudo pacman -S sddm

    # add sddm to system startup
    sudo systemctl enable sddm

    # install i3 package group
    sudo pacman -S i3-gaps