Install Linux on a MacBook

Nick Peers breathes new life into a Mac by installing Linux alongside OS X with a shared data partition. Read our: Install Linux on MacBook

Given that macOS is based on Unix, you’d think Macs would be a lot friendlier towards Linux than they are. But then perhaps the reverse could be said as well: most iterations of Linux won’t appeal to Mac users who believe Apple’s ‘it just works’ mantra that’s stuck in a one-button world.

Nevertheless, why limit yourself to Apple’s closed garden when you can – with the help of this feature – install a Mac-friendly flavor of Linux alongside OS X?

[sc name=”ad 2″]

Macbook linux dual boot

Our dual-boot approach ensures you won’t lose access to OS X, and we ll even step you through the process of setting up a shared data partition -and moving your Mac home folder to it – so both OS X and Linux can easily access key folders. We’ve also chosen a flavor of Linux – Elementary OS – that has been designed to appeal to Mac switchers, boasting a beautifully styled desktop with familiar elements, including a dock at the bottom, menu bar and minimalist design.

Install elementary os on macbook

Elementary’s a particularly good choice for Mac switchers because it has built-in read/ write support for the Mac’s HFS+ file system. There are some caveats: it doesn’t like the Mac’s built-in FileVault encryption, so make sure that’s switched off before you begin, and you also need to disable journaling on the data partition – we step you through the quick process of doing so. In our feature, not only do we show you how to access your Mac’s home folder from Elementary, we also reveal how you can create symbolic links from your Elementary user folders so they point to your Mac folders on a shared data partition.

Backing up

Everything you need to set up your Mac old or new, install Elementary and get started with it is covered in this feature. One last thing, because we re always saying this, it pays to take a full backup of your Mac using Time Machine before you begin. Once that’s done, start reading the next page to get started.

We’ve chosen a flavor of Linux that has been designed to appeal to Mac switchers.

We’re going to set up Elementary in a dual boot configuration alongside OS X. We’re also going to set up a shared data partition between the two OSes, so you have easy access to your data. We’ll then move your Mac user folder to the data partition.

Partitioning

This involves partitioning your hard drive. Step one is to partition it in two by hiving off enough space to create both your shared data partition and – further down the line – the partitions for Elementary. Partitioning can be done within OS X itself using the Disk Utility tool – ironically, the older your version of OS X. the better the tool is.

First, ascertain how much disk space you want to allocate to your data partition. Open Finder, right-click your user folder under Favorites in the navigation pane and choose Get Info. Make a note of its current size, and ask yourself how much extra space you’ll need – say another 20GB on top of the current figure. You then need to add on additional space for your Elementary installation – a bare minimum of 12GB (8GB plus 4GB swap partition), but we recommend hiving off 24GB or even more if you plan to play games in Elementary.

Ironically, the older your version of OS X, the better the Disk Utility tool is.

Next, check to see how much free space is on the disk. If it’s at least 2GB more than the amount you wish to allocate to your new partitions, skip to the next step: if not. move files inside your home folder to a backup drive temporarily to free up the space (or – if most of your files are in iCloud – temporarily switch that off following the advice in the next section). We ll tell you when it’s safe to move them back. Then partition your drive following the advice in the box (below).

By default, your data drive has journaling enabled – this means you’re restricted to read-only access in elementary. To write files to the drive – for example, through a shared Documents folder – open Applications > Utilities > Terminal on your Mac and type:

$ diskutil list

Locate your data partition in the list and note its identifier. Type the following:

S diskutil disableJoumal /dev/disk0s4

This disables journaling for the partition. Be sure to replace disk0s4 with the identifier you made a note of for your partition.

Move home folder

Next, you need to move your home folder to your data partition, so you’ll be able to share its contents with your Elementary installation. Before doing so. we recommend temporarily switching off iCloud Drive if you use it: open System Preferences from the Apple menu and select iCloud. Untick iCloud Drive and choose Remove from Mac when prompted.

Disable journaling on your data partition if you want to write to the drive in Elementary.

Disable journaling on your data partition if you want to write to the drive in Elementary.

Once done, open two Finder windows, one pointing to your main partition, the other to your data partition. Open the Users folder and drag your user folder to the data partition. Allow it to copy the files rather than move them. Assuming the files copy over OK. open System Preferences again, but this time select Accounts or Users & Groups.

Click the lock to make changes, enter your password, then right-click your username and choose Advanced Options. Click Choose next to Home Directory to select your user folder on the data partition. While here, note your User ID and Account Name. You’ll need these later. Once selected, click OK.

Before closing System Preferences, create a new administrator user whose folder is on your OS X system partition – this allows you to boot into OS X even if something happens to your data partition. Click +. name it something like Emergency (give it the same password as your main user account), plus make it an administrator. Click Create User.

Partition your drive

The partitioning process differs depending on which version of OS X you have installed on your MacBook. The only thing that’s the same is how you launch Disk Utility, which is done via the Applications > Utilities folder.

Partitioning is done using the Mac's Disk Utility tool - ironically, it’s not as powerful in later versions of OS X.

Partitioning is done using the Mac’s Disk Utility tool – ironically, it’s not as powerful in later versions of OS X.

If you’re running OS X 10.10 or earlier, select your physical hard drive and switch to the Partition tab. Select your Mac partition and reduce its size by all the space you need, using the slider. Click the + button to create a second partition in the space, name it Data and then reduce its size to leave enough free space for Elementary. Click Apply.

If you’re running OS X 10.11 (El Capitan) or later, things are more complicated, because Disk Utility doesn’t allow you to create free space, merely set up additional partitions. For now. select the physical disk (not the OS X partition) and click Partition. Click the + button and a new. untitled partition appears. Name it Data, leave its format set to Mac OS Extended (Journaled) and then set its size to the additional space you need – in other words, the size of the data partition plus the amount of space you wish to give to elementary. Now click Apply.

Once done, select the Data partition and click + again. A third partition is created. This is a temporary measure, so for now. simply allocate it the amount of space you plan to give Elementary, change its format to FAT32 and click Apply once again.

Now reboot your Mac – if all is well, clicking your username in the Favorites bar in Finder should point to your data partition. You should find nothing else has been affected by the move. Once you’re happy, clear off the user folder from your main system partition, switch iCloud Drive back on and restore any files you temporarily moved off the drive.

A new boot manager

It s time to install the rEFInd boot manager, which allows you to switch between OS X and Elementary easily – it sports a graphical icon-based interface you can control via keyboard using the cursor keys, and always defaults to the OS you booted to last. Download rEFInd from www.rodsbooks.com/refind/getting. html – click the Binary Zip File link and save it to your Downloads folder.

If you’re running El Capitan or later, you’ll need to temporarily disable System Integrity Protection – reboot your Mac. then press and hold down Cmd+R when the startup chime sounds. Release when the Apple logo appears and the recovery environment should eventually start. When it does, choose Utilities > Terminal. Type csrutil disable and hit Enter, then restart.

Return to your Downloads folder and look for a folder named refind-bin-0.10.4 or similar (if it’s not there, simply double-click the zip file of the same name. Open the folder, then open Terminal via Applications > Utilities before dragging the refind-install script file from the Finder window into the Terminal.

It appears in the command line, so hit Enter, provide your password and hit Enter again. It should end with an Installation has completed successfully’ message, so restart your Mac and you should see the rEFInd boot manager in all its glory. At this point, if you’re running El Capitan or later, use the cursor keys to select Apple Recovery, then hit Enter. Reopen the Terminal as before, but this time type csrutil enable and hit Enter to re-enable SIP. Reboot into OS X proper.

Create install media

The final stage of prep involves creating your Elementary boot media. Go to https://elementary.io – if you don’t plan to pay, enter 0 in the $ Custom field and click Download Elementary OS. Save the ISO file to your hard drive. While you wait for the 1.2GB download to complete, download and install Etcher from https://etcher.io and source a 2GB USB flash drive (you can burn the ISO to DVD if you prefer by right-clicking it and choosing Burn Disc Image, but it’s very slow).

Once the ISO file is downloaded, launch Etcher and select the ISO file. Plug in your USB flash drive if you’ve not done so already and it should be detected, so click Flash! and wait for the boot media to be created. Click Ignore at the end of the process – OS X won’t recognize the files on the drive.

Time to install

The moment of truth is here: it’s time to install Elementary OS alongside OS X. With your boot media inserted, restart your Mac. You should see a new Penguin icon has appeared in the rEFInd boot menu, so select it and hit Enter. When prompted, choose Install Elementary OS.

 

You need to manually create the partitions needed for Elementary during setup.

You need to manually create the partitions needed for Elementary during setup.

Select English and click Continue when prompted, then connect to your Wi-Fi network if necessary. Tick both boxes to download updates and third-party software, then click Continue again. The next stage is the trickiest bit of the installation. Elementary won’t detect OS X. so won’t offer to install itself next to it. Instead, you need to select Something Else and click Continue. When the

First steps in Elementary

Once Elementary is up and running on your MacBook. you’ll want to explore it. It’s based on Ubuntu 16.04. but utilises its own desktop, which is designed to appeal to Mac switchers. You can tart your tour at https://elementary. io/docs/learning-the-basics but the desktop is laid out quite logically, with a dock. Applications pop-up menu (similar to the Windows Start menu) and a menu bar at the top of the screen with access to key system settings. Application windows don’t come with traditional menus – try clicking (or right-clicking) on the program window title bar to see whether any options pop up.

There are some other restrictions, too. that more experienced users will probably want to fix – for starters, the software-common-properties package isn’t installed by default, which prevents you from adding third-party repositories. Thankfully, it’s a simple enough fix – simply open a Terminal window and type in the following command:

$ sudo apt-get update && sudo apt-get install software-common-properties

We’ve also experienced a few problems with the App Center not behaving as it should. To fix this, make sure you upgrade Elementary to the latest version after installing it. again via the Terminal, with the following:

$ sudo apt-get update && sudo apt-get upgrade

After this has finished – it’s a lengthy process – type sudo reboot and hit Enter to reboot Elementary. You should find App Center works correctly again.

Elementary's user interface is specifically designed to appeal to Mac switchers, but you still have full access to Linux.

Elementary’s user interface is specifically designed to appeal to Mac switchers, but you still have full access to Linux.

partition table appears, you should see either free space or – if you partitioned in a later version of OS X – the FAT32 partition at the end of the list. If it exists, select the FAT32 partition and click the minus button underneath to remove it.

Select the free space and click the plus button. Set the size in the Create Partition box to 4096MB to create a 4GB swap file, select End of this Space, click the Use As menu, set to Swap Area and click OK.

Finally, select the remaining free space and click + again. Leave all the settings as they are except for the Mount Point – click this and set it to /. Click OK then Install Now. Review the changes and click Continue.

Next, verify your timezone is correct, then select the Macintosh keyboard for your country. When you provide a username, we recommend choosing the same username as you recorded earlier from your Mac. Set a suitable computer name and password, then leave the installation to proceed to its finish.

Restore rEFInd

After you’re prompted to reboot, you boot straight into Elementary for the first time. Step one is to bring back rEFInd: open the Epiphany web browser and download the same binary zip as before. Click the Applications shortcut in the top-left corner of the Elementary desktop and select Files. Navigate to Downloads, then right-click the zip file and choose Extract Here. Open the newly created refind-bin folder, then right-click inside the Files window and choose Open With > Terminal. Finally, type:

$ ./refind-install

Enter your account password when prompted and a series of messages should appear, confirming that rEFInd has been restored as the default boot manager. Restart and you can now easily switch between OS X and Elementary.

Access home folder

As things stand, you can see your data partition, but any attempt to browse your Mac s home folder results in you being told you don’t have permission to browse the folder in question. This can be fixed by opening a Terminal window and entering:

$ sudo groupadd admin

$ sudo useradd -d /home/tempuser -m -s /bin/ bash -G admin tempuser

$ sudo passwd tempuser

Enter a password when prompted, then reboot and log in as tempuser. Open Files and eject the data partition if it’s connected (look for the eject button). Then open another Terminal window and type the following:

$ sudo usermod -uid 501 yourusername

$ sudo chown -R 501:yourusername /home/ yourusername /media/username

Replace 501 with the User ID that you recorded when moving your Mac’s home folder to the data partition, and replace yourusername with your actual username. One final thing – as things stand, your user won’t be visible at the login screen. To rectify this, type in the following command:Replace 501 with the User ID that you recorded when moving your Mac’s home folder to the data partition, and replace yourusername with your actual username. One final thing – as things stand, your user won’t be visible at the login screen. To rectify this, type in the following command:

$ sudo nano /etc/login.defs.

Press Ctrl+W. type UID_MIN and hit Enter to find the following line:
UID.MIN 1000

Change 1000 to 501 (also do the same for the line beneath it beginning GID_M1N ). save the file and reboot. You should now be able to log in as yourself, plus access your Mac’s home folder and all its contents. Once done, remove the temporary user:

$ sudo userdel -r tempuser

You’re now ready to explore Elementary proper, secure in the knowledge that your data is easily accessible. To link specific data folders, such as Documents, from your Mac to your user folder in Elementary, check out the box (below).

The rEFInd Boot Manager provides a graphical boot menu to make it easy to switch between operating systems.

The rEFInd Boot Manager provides a graphical boot menu to make it easy to switch between operating systems.

Link user folders
As things stand, you’ve gained access to your Mac’s home folder, but why stop there? By creating symbolic links, you can redirect your Elementary user folders – Documents. Pictures. Music and so on – to the relevant folders on your data partition. You choose which folders to link – you’ll probably want to keep Downloads separate, for example – but first, make sure your data partition is automatically mounted at startup.

To do this, dick Applications and choose App Center. Search for to install the Ubuntu
Disks tool. Once installed, open it from the Applications menu. Select your data partition, dick the Settings button beneath it and choose Edit Mount Options. Switch Automatic Mount Options to Off. Change Identify As to /dev/disk/by-Label/<Partition Name> and verify the Mount Point is Click OK. then reboot. Now that you’ve got an automatic mount point, first open your Elementary user folder and delete those folders you plan to create links to. Now open the Terminal and type the following, substituting the name of your data partition for Data and your username for username:

$ In -s /mnt/Data/username/Documer/home/username

You should see a folder shortcut appear in your Elementary user folder. Now repeat for any other folders you wish to link.

Was this article helpful?
YesNo

Let us know your thoughts on a product or view reviews from our members, independent experts and other websites.

Leave a reply

TOP NEW Review
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart