Installing Linux on MacBook Air: Why would anyone need it, how to do it and what do we get in the end — I’ll try to answer these questions in this article.
Warning! Even if you install Linux on an external drive, it will change your boot loader. Without this change, Linux won’t boot. Unlike Windows, Linux is not officially supported by Apple, so installing it may cancel your warranty.
About a year ago my MacBook Pro unexpectedly died. As a mobile developer, I need to have a Mac with macOS because Xcode doesn’t work on any other platform. As I was on a trip abroad and I had urgent projects to finish, the easiest solution was to just buy a simple MacBook Air, until I could get something better or repair the old one. Then I would just leave it as a backup Mac.
People who have tried to compile an iOS project on a cheap (as if a Mac can be called so) device, know how hard it can be. There’s not enough memory, not enough disk space, Xcode crashes and gets “stuck”. It’s possible, but very uncomfortable.
Looking at the characteristics of my MacBook, I came to the conclusion that it’s not so bad. Dual-core processor, 8 Gb RAM, 128 Gb SSD. I had a PC with worse configuration about 15 years ago and it worked very fast. So why is it that now the compilation of an iOS app with 15–20 screens takes about 20–30 minutes, when 15 years ago the same 20–30 minutes were enough to compile OpenOffice (previous name of LibreOffice)? What if the problem is not in the hardware, but the software?
Installing Windows on a MacBook with 128 Gb SSD is nearly impossible. BootCamp — the tool to install Windows, allows to do so on internal (non-removable) drives. Splitting 128 Gb between two systems means not having software on any of them. On the other hand, Linux can be installed on an external drive, it has resource-efficient software and has all drivers for a MacBook Air.
Another problem of new versions of macOS (starting with Catalina) is the lack of compatibility with 32-bit software. It makes macOS a bad choice for gaming. I’m not talking about modern games with high system requirements, but there are many games from the 2000s and 2010s, which could run on MacBook Air but don’t have a64-bit version.
So, again, why installing Linux on a MacBook Air?
Answer: To make the system work faster, to get more software, to get an alternative system.
Question: What are the requirements?
What do we need to do to install Linux? Is it free or it does it need any investments?
First, we need a storage device. Linux works basically from anything — USB flash drives, SD cards, internal or external HDDs/SSDs. Using USBs is a bad choice because of the low performance. As we decided that we want a faster OS, a USB HDD won’t work. But macOS has a rather good SD card reader. A128 Gb SD card will do the trick.
Second, we need a USB flash drive for the installer. Modern Linux installers are actually live distributions. It means that the flash drive contains the fully working Linux environment with the installer. The flash drive should have at least 4 Gb.
Third, we need software to write the live distribution on the flash drive. I chose Mac Linux USB Loader from SevenBits. It even allows to download the Linux distribution, but the versions are not the latest. So I downloaded the distribution from the official website. Mac Linux USB Loader is not free, but the price is reasonable — about $5.
Talking about distributions. There are more than 10 popular Linux distribution. What to choose? My first choice was Linux Mint. I like it because of the Cinnamon desktop environment. But it didn’t boot. Probably the live distribution didn’t have drivers for MacBook Air.
The second and the most popular option (according to most rankings) is Ubuntu. The Cinnamon desktop environment can be installed on it separately.
What do we need for the installation?
Answer: We need a USB flash drive (4 Gb or bigger), a fast SD card (128 Gb or bigger) and a Mac Linux USB Loader. The total price is about $40-$50.
Question: How to install it?
After you get all the required hardware (the USB flash drive and the SD card), let’s download software:
- Mac Linux USB Loader — they require to make the payment before downloading. As soon as you pay, you get a download link by email.
- Ubuntu Linux — you need to download the 64-bit version for architecture x86_64 (or amd64, which is the same).
Insert both the Flash drive and the SD card. Restart your Mac and hold the Alt/Option key. You’ll see two options — your Mac SSD drive and the USB Flash drive (marked as EFI Boot). Choose the second option.
After the system is loaded, you can play with it to see if it works. WiFi may not work (see below how to fix it). When you’re ready, run the installer app (it’s the first icon on the sidebar and the icon on the desktop).
You’ll see an installation wizard with several steps. It’s not very important what you’ll choose on most of them, but you need to choose installation drive correctly.
Since this moment you must be extremely careful. Don’t erase internal SSD drive (unless you want to do it).
On the Installation type screen choose Something else, otherwise it will overwrite your macOS system.
Very likely your SD card will be on /dev/sdb. You can either create one partition with Linux, or a big partition with Linux and small one with swap. You can see my partitions on the screenshot above.
In the bottom box choose the drive labeled as APPLE SD Card Reader.
Installation takes several minutes. Then you need to reboot.
How do we install it?
Answer: The installation process is almost automatic, you only need to be careful with disk selection.
Question: How to choose the OS?
Now you have both Linux and macOS. How do you load one or another system?
When you install Windows, you can choose it in BootCamp. Here BootCamp won’t help. By default, one of systems will be loaded, probably it will be Linux. To open select, you need to hold the Alt/Option button right after turning your MacBook on. In my case, I see two “Efi boot” options, not very helpful. The third option on the screenshot below is the USB Flashh drive with Live Ubuntu distribution. One of them is Linux and another one is macOS. Try to choose them both and see what happens.
Obviously, you need to have an SD card inserted into your MacBook if you want to load Linux. If the SD card is not there, Linux won’t load, but the boot option won’t disappear.
One strange fact I noticed: when I don’t hold the Alt/Option button, it tries to load Linux. But it fails even if the SD card is inserted. Maybe the SD card needs some time to start working after powering on. Be ready for this side effect, your Mac may not start at all without holding the Alt/Option button.
How do you choose the OS?
Answer: To select the OS you need to hold the Alt/Option button right after turning your MacBook on.
Question: Will everything work?
One of the most popular questions on Linux forums is “will my hardware work under Linux?” In case of MacBook, the answer is “yes”. But it doesn’t mean that it will work automatically.
When I loaded Linux from the SD card for the first time, there were two things which didn’t work — WiFi and the camera. And if the camera is not a big problem (we’ll discuss it later), running WiFi without WiFi is a problem.
I solved this problem using my Android phone and USB cable. Some phones support “Tethering over USB”. Another option is Bluetooth.
Yet another option can be “chrooting” from the Live USB supporting WiFi.
If you don’t know what is “chrooting”, it’s changing the root of the Linux system. It means that you load one system and then switch to another without restarting it. You can find details, for example, on Wikipedia.
To enable WiFi, first of all, confirm that you have a Broadcom adapter:
lspci -vvnn | grep -A 9 Network
To enable WiFi, you need to do the following:
sudo apt-get update
sudo apt-get --reinstall install bcmwl-kernel-source
sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
sudo modprobe wl
The MacBook camera is always Facetime HD. To activate it, run these commands one by one in terminal:
sudo apt-get install git
sudo apt-get install curl cpio
git clone https://github.com/patjak/facetimehd-firmware.git
sudo make install
sudo apt-get install kmod libssl-dev checkinstall
git clone https://github.com/patjak/bcwc_pcie.git
sudo make install
sudo modprobe -r bdc_pci
sudo modprobe facetimehd
sudo nano /etc/modules
in the end of the file. Then press Ctrl+O, enter and Ctrl+X. Your WiFi should immediately appear and stay after reboot.
So, will everything work?
Answer: Yes, everything will work, but it needs some effort.
Question: Was it worth it? Does it work well?
I can talk about my personal experience. Having 128 Gb for both macOS and Linux, I can say that with a full set of apps (developer tools, messengers, office, graphic applications, etc) the Linux’s SD card has 40–45 Gb free space, macOS only 20–25 Gb free space.
I can’t comment on Xcode because it doesn’t work on Linux. Other developer tools run 2–3 times faster on Linux: Android Studio, CLion, WebStorm and Visual Studio Code.
I tried Steam on both platforms. The Linux version offers more games, but some of them work via Proton (compatibility layer allowing to run Windows exe in Linux environment).
Google Chrome works rather fast on both platforms, I didn’t see much difference. Same regarding loading time and terminal commands.
Is it worth it?
Answer: Surprisingly, my Linux works much faster than macOS. I could install more software and now use this system for tasks not related to iOS or macOS programming.
Question: How can I replace the macOS software?
Here’s a list of matches, also from my personal experience.
Web and email
- Google Chrome, Firefox for web surfing
- Thunderbird, Mailspring for email
- Android Studio for mobile development (supports native Android development and Flutter)
- Unity, Unreal Engine for game development
- KDevelop, NetBeans, CLion, Code::Blocks, IntelliJ IDEA for desktop development
- Visual Studio Code, WebStorm for web development
- Git Cola, GitKraken for source control
- LibreOffice Draw
- Google Docs
- KDE Office
- Galaxy of Games (GOG)
- Albert (similar to macOS Alfred)
- Nautilis, Nemo (file browsers, similar to Finder)
- Snap Store (similar to App Store)
- Double Commander, Midnight Commander (dual-panel file browsers)
- Yakyak (Google Hangouts)
- Apple Music (web-based app)
What won’t work on Linux?
- Apple FaceTime
- iOS Simulator
- Visual Studio and Xamarin Studio
- Internet Explorer
I hope this information was helpful for you. Be careful with operating systems, it’s always risky to modify your system. If you can’t run macOS, try to hold Cmd+R on boot and restore it.
If you’re not ready for such changes, but you are not completely happy with how macOS looks, try to make it look different:
How To Make macOS Look Different
As a full-time mobile developer, I need to build apps for iOS. Unlike Android development, which can be done under…
See you next time!