Installing Debian on my Mac wasn't as easy as I probably made it sound. It didn't work the first time, and when it did work, I was unsatisfied because I hadn't installed it the "right" way. I've written this tutorial so that others can learn how to install Linux on a Mac without having to repeat my mistakes. I know that nobody has asked for a tutorial here, but it's good information to have, and someone will probably find it through a search engine.
CIRCUIT'S GUIDE TO INSTALLING LINUX ON A MACedited 8/10/13Should I install Linux on a partition or in a VM?Linux runs faster outside of a VM. However, installing it on the hard drive requires a lot of work, risk, and time. You should only do it if you're sure you really want to.
Why is this guide for Macs? Is installing Linux on a Mac different from installing it on a PC?Yes. Even though Apple switched to Intel architecture in 2006, Macs and PCs still have significantly different hardware:
- Intel Macs use Apple's proprietary variant of a EFI to boot up, whereas PCs usually use a BIOS.
- Intel Macs use a GPT to divide the hard drive into partitions, whereas PCs have historically used an MBR.
This is changing. All new Windows 8 machines are required to boot from UEFI and use GPT partitions. - In order to boot Windows XP or Windows 7, Boot Camp must construct a "hybrid MBR" and emulate a BIOS. This is complicated, dangerous, and just barely works.
The point is: If you want to install Linux the same way you install Windows, you're asking for trouble!
So how should I install it?You should install Linux on GPT partitions and have it boot natively via UEFI, which is the natural way to install it on a Mac. I'll explain how.
You'll need the following:
- A means for backing up your important files prior to partitioning (USB drive, DVD-Rs, cloud, etc.)
- At least 30-40 free GB of contiguous free space on your hard drive
- A bootable Linux install CD or DVD with an EFI or UEFI bootloader
- Either rEFIt or rEFInd (preferably rEFInd) to use as a new boot menu
- If you have Windows, you will need your Windows install CD/DVD
- An OS X install disc just in case something goes terribly wrong
Okay, so what do I do?- Download rEFIt or rEFInd on your Mac partition and install it. After you've restarted once or twice, it'll appear every time you boot up.
- Create the Linux partition(s) using OS X Disk Utility or Windows Disk Manager. It's best to partition the disk before installing anything, but if you have an OS installed already, you may need to use a special utility to move files away from the end of the disk so that you can have contiguous space for partitioning.
rEFIt and rEFInd can only "see" 4 partitions in the hybrid MBR, and I'm not sure why that is. To be safe, make sure that OS X, Windows, and the Linux boot partition are among the first 4 partitions of the disk.
You can create multiple new partitions for different parts of the Linux system (/, /boot, /home, swap, etc.) just as long as the bootable partition is one of the first 4 partitions of the disk. - If you have Windows installed, that installation was broken when you repartitioned the drive. Don't worry, it's easy to fix. Reboot, use the gptsync utility at the rEFIt/rEFInd boot menu, and boot your Windows install disc to repair the installation. (Note: If you're using rEFInd, you will need to edit a config file in OS X to make gptsync appear at the boot menu.)
- Insert the Linux install disc. Reboot again and hold down the Option key while booting. (Do NOT hold down the C key! Installation will fail if you use the C key.) Wait for a DVD named "EFI-boot" to appear. Select it and hit Enter.
EDIT: The idea is to boot the install disc the same way you will boot the operating system: in EFI mode. In theory, if the installer boots in EFI, then it will detect the EFI and install an EFI bootloader... but if it boots in BIOS, it will try to install a BIOS bootloader, which will fail because the machine uses EFI. Unfortunately, this trick doesn't work with all Linux distros, and it may not even work with Debian on Macs different from my own (MacBook6,1). - Install Linux. This is mostly straightforward. You will have to do a "manual" install instead of a "guided" install to select your Linux partition(s). The only partition you really need is a root directory partition, mounted as "/", and it must be marked as bootable.
- Restart again, run gptsync again, maybe repair the Windows installation again, and restart once more.
- If you see all of your operating systems at the boot menu, then your machine must not be completely screwed up! Try loading each operating system. If they all work, congratulations! If one or more of them don't work... well, I told you this was risky. Don't worry, this is easy to fix with the right tools, like the Windows install disc.
There's a good chance that this plan won't work for you 100% because each Mac is different. You should supplement it with other tutorials that you find on the net. You probably won't find a tutorial that's tailored for your exact machine and Linux distribution, but you will learn more about how things work, and eventually you will figure out how to run Linux on your Mac.
Will Linux be able to use my graphics card?NVIDIA graphics card drivers don't work with Linux when booted from EFI. There may be ways to get around this, but I don't know how. You probably don't need the GPU in Linux anyway.