Linux Format

Linux on a MacBook.

Nick Peers breathes new life into a Mac by installing Linux alongside OS X with a shared data partition.

-

The hurdles and hard reboots you need to go through to get Linux installed on your 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.

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

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 flavour of Linux – Elementary OS – that has been designed to appeal to Mac switchers, boasting a beautifull­y styled desktop with familiar elements, including a dock at the bottom, menu bar and minimalist design.

Elementary’s a particular­ly 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.

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 flavour of Linux that has been designed to appeal to Mac switchers.”

We’re going to set up Elementary in a dual-boot configurat­ion 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.

This involves partitioni­ng 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. Partitioni­ng 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 installati­on – 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.

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 temporaril­y to free up the space (or – if most of your files are in iCloud – temporaril­y 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 Applicatio­ns > Utilities > Terminal on your Mac and type: $ diskutil list Locate your data partition in the list and note its identifier. Type the following: $ diskutil disableJou­rnal /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 installati­on. Before doing so, we recommend temporaril­y switching off iCloud Drive if you use it: open System Preference­s from the Apple menu and select iCloud. Untick iCloud Drive and choose Remove from Mac when prompted.

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 Preference­s 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 Preference­s, create a new administra­tor 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 administra­tor. Click Create User.

Now reboot your Mac – if all is well, clicking your username in the Favorites bar in

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

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 temporaril­y 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 iconbased 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 temporaril­y 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 environmen­t 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 Applicatio­ns > 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 ‘Installati­on has completed successful­ly’ 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 recognise 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.

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 installati­on. 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

partition table appears, you should see either free space or – if you partitione­d 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 installati­on 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 Applicatio­ns 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 rightclick 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 youruserna­me $ sudo chown -R 501:youruserna­me /home/ youruserna­me /media/username Replace 501 with the User ID that you recorded when moving your Mac’s home folder to the data partition, and replace

youruserna­me 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_MIN ), 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).

 ??  ?? You need to manually create the partitions needed for Elementary during setup.
You need to manually create the partitions needed for Elementary during setup.
 ??  ?? 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.
 ??  ??
 ??  ??
 ??  ?? 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.

Newspapers in English

Newspapers from Australia