Begin by selecting the “Mac” checkbox in the project settings of your existing iPad app to create a native Mac app that you can enhance further. Your Mac and iPad apps share the same project and source code, making it easy to make changes in one place. Installing Linux on a Mac isn't quite as straightforward as installing it on an older Windows machine, and you need to make a few tweaks in the installation process. You'll need a USB Thumb stick. By default, Mac file systems are case-insensitive while Linux is case-sensitive. On Linux, it is possible to create 2 separate files: test and Test, while on Mac these filenames would actually refer to the same underlying file. This can lead to problems where an app works correctly on a Mac (where the file contents are shared) but fails when.
For anyone interested in getting Arch Linux on their MacBook Pro, a simpleGoogle search will come up withmany guides, Q&As, blog posts, and wiki entries. My intention in writing thisis not to add more noise to this cacophony of advice or to reinvent the wheel.It’s just that in the process of getting a distro of GNU/Linux up on my machinein a way that works for me, I had to deviate a bit from the otherrecommendations out there. This entry is as much for myself—when the daycomes that by necessity or by whim I need to install Arch again—as it is foranyone else curious about taking on such a task.
Why Arch?
Perhaps in another post where I have more room and time I will get into all thereasons for installing GNU/Linux on my MacBook. As to why Arch Linux: AlthoughI’ve been content with Mac OS X over the years, every so often I would installa Linux distribution to see the state of free/libre OSes. This began withUbuntu 8.04 back in 2008. I mostly stuck with Ubuntu since then when I wantedto play around with Linux. Last year I gave Fedora a try, as well as LinuxMint. Linux Mint seemed to provide the best Mac hardware support to date, butthere were a few packages I rely on that were too out of date in Linux Mint’sUbuntu 14.04 base, and I didn’t want to deal with a bunch of manual .debpackage installs or PPAs that were often out of date, too. A few months prior Ihad gotten a cheap little HP Mini Stream PC to use at my school office. I gotArch up and running on that no problem, and I really liked the rolling releasecycle of packages that kept everything nice and fresh. And the Arch UserRepository (AUR) was great at providing pretty much everything I could need orwant. So, I decided to give Arch a try on my MacBook. I loved it … mostly.There’s a few annoyances, but I’ve since shrunk my OS X partition down to justa failsafe. I’m using Arch on it full time now.
Why Cinnamon?
Like the topic of GNU/Linux distros, I could spend an entire post talking aboutwhy I settled on Cinnamon. I really like the customization of Xfce, but nomatter how much I tweak it, it just seems a little outdated to me. It’s purelypersonal preference, but I feel Cinnamon just has a little more polish on it,but it’s still very much customizable. It has many of the desktop and windowmanagement features of OS X that I liked but none of the ones that have begunto annoy since OS X 10.9.
So, this guide is going to install Cinnamon as it’s desktop environment. Thegreat thing about Arch, though, is you’re free to switch to any otherenvironment pretty easily. I’ve used Xfce and GNOME on Arch just fine.
Get on with It!
OK, so installing Arch. I relied on three other Arch-on-MacBook guides to helpme through the process:
Presumptions
This “guide” makes a number of presumptions about your setup and installationgoal:
Finally, here is the setup I’m installing on:
Getting the Installation Media
First, we need to get Arch. Go here to download it:https://www.archlinux.org/download/
I usually go with the torrent option. It does seem to be the fastest.
Next, we’re just going to make sure the download went OK; it wasn’t corrupted,tampered with, or anything like that. Fire up the terminal and
cd into thedirectory where the downloaded ISO is at. Run the following:
Where
XXXX is the correct name of the ISO you downloaded.
Next, check the signature. This assumes you have GnuPG installed on yoursystem. On the download page, there is also a link under “Checksums” to get thePGP signature as a
.sig file. Download that, ideally into the same directoryas your Arch ISO. Run:
You’ll probably get some error about the public key not being found. Copy thatpublic key and run this:
Where
YYYY is that public key you just copied. Run the previous gpg commandagain, and it should verify it now alright.
Now we’re ready to get that ISO onto a USB drive so we can boot the computerfrom it. Before inserting the thumb drive, run
lsblk and take note of thedrives listed. Insert the drive and run lsblk again. Take note of the thirdletter in the sdx of the thumb drive. Be sure to unmount the thumb drive:umount /dev/sdx
Next, run the following to copy the ISO to the USB drive:
After that’s run, it should be all set to go. If you’re using OS X to createthe installation media, the steps will be the same, but some of the commandswill be different. You’ll use
diskutil list instead of lsblk , diskutil unmount /dev/diskX to unmount the drive, and use the flags bs=1m andof=/dev/rdiskX (note the ‘r’) when running dd .
With the USB drive plugged in, restart the MacBook and hold down the option/altkey. Right at boot time a screen should pop up with your boot options. Your USBdrive should be one of the options. Pick it along with the first option thefollowing boot screen lists. Now you should be at the Arch live install prompt.
Doing the Base Installation
On the HiDPI (Retina) display of my MacBook, the prompt is really small. Setthe font using
setfont sun12x22 to get a more comfortably sized font on thedisplay.
Internet
You’ll need a working Internet connection to do the install. I have anethernet-USB adapter that I use. That’s the easiest way as it works out of thebox without any fiddling with wireless drivers (which we’ll deal with later).
With the adapter plugged in, make sure it’s working by pinging Google:
You should get a response that all three packets were sent and received.
System Clock
The system clock should be just fine. The general Arch wiki recommends ensuringthe system clock is accurate, and I’ve found it doesn’t seem to break anything.So, I run it:
Partitioning the Drive
Now comes the tricky part, or at least the part I’m most scared of screwing up:partitioning the drive. This will destroy data on the disk, so please do becareful.
As mentioned earlier, I assume the drive has free space available to make theinstallation. Apple uses the GUID Partition Table (GPT), and we’re going tokeep that partition table. I’ve used parted before to do partitions (and ithandles both MBR and GPT partition styles), but cgdisk is nice. Start cgdisk:
At the end of the partition table should be the free space you already created.With that, we’re going to create a new partition. You just need to make onepartition; we’re going to break it up later after the encryption is setup.
I added 128MB between the last partition and my new partition because of thisexplanationby Apple.
You’ll want to use Linux LVM (8e00) as the partition type id. The finalpartition table will look something like this:
Getting Encryption and LVM Setup
You’ll want to make note of the partition number you just created. For me it’spartition 3, and the drive is sda, so my Arch Linux partition can be found at
/dev/sda3 .
We’re going to encrypt
/dev/sda3 using DM-Crypt and then the LVM partitionsare going to be created over that LUKS encryption layer. So, it’s called “LVMon LUKS.” Both LUKS encryption and LVM support are provided by the Linuxkernel, so it should be well supported and maintained (ideally).
(NB: This will just encrypt the system /root and /home directories. The /bootdirectory will not be encrypted because we’re going to use the /boot partitionthat’s there. That’s
/dev/sda1 in my partition table above.)
How To Make App On Mac Book Architect
OK, let’s get the partition encrypted:
The
-v Mac apps store download. flag is for verbosity. This will give all the other setup flags theirdefault values. As of writing this, doing the above command is the equivalentof running this:
Enter in a good passphrase (twice), and we should be good to go.
Now with the encryption setup, we’re going to create the necessary volumes andfilesystems within the LVM.
First, let’s open up our encrypted partition:
This is going to map our encrypted device (
/dev/sda3 in my case) to/dev/mapper/lvm . Now we’re going to create the physical and logical volumesfor the root and user directories. I gave the root directory 40GB (hopefullyenough for all my programs and whatnot. As of writing this, and with a fullinstall, I’m using 10GB on my / directory. So, I think I’m good.
Create the physical volume:
Now create the volume with the name
vgcrypt :
We’re ready to create the logical volumes now (40GB for root and the rest forusers’ home):
We now have our two volumes
vgcrypt-root and vgcrypt-home . They need to beformatted to a particular filesystem. I’ve been happy with ext4.
If all’s gone OK, we should be able to mount our newly created partitions. Makesure to mount the root partition first so we can create the
/home directoryinside of it for the home partition:
And with that, Arch is ready to be installed on the disk.
Select a Mirror
This step can optionally be skipped, but I like to choose a US server just incase it might be faster. Open up the mirrorlist:
Delete or comment out all the servers except one or two in the US that seemgood.
Install the Base System
OK, let’s actually install Arch now:
The
-i flag asks for confirmation before installing packages. I like using itjust so I can see what’s being installed. (After all that’s part of the reasonfor using GNU/Linux, right? To know what’s being installed on your system.)
Generate the fstab
If all went according to plan, Arch is now installed. Before changing into ourinstallation, though, we need to tell the system where to find the filesystemswe created earlier for root and home directories.
While it’s normally a good idea to use UUIDs to find disks, we’re going to uselabels. This is because our encryption setup generates random IDs for the diskswhen they’re decrypted. Let’s create the fstab file:
The
-L flag will generate the fstab file with labels instead of UUIDs. The-p flag prevents pseudo-filesystems from being added.
Always check the generated fstab:
It should look something like this:
If the
discard option isn’t there, vi into the fstab file and add it. It’sused for SSD hard drives.
Configure Our New System
We’re now ready to configure our new system. Let’s change root into it:
Set our system locale. Because I also use Thai, I like to generate the localefor it, too. I’m actually not sure if this is the proper way or not, but ohwell. Uncomment the following from
/etc/locale.gen :
Now generate the locales:
Make English UTF-8 the default:
We want the font change we made at the beginning for the console to also be thefont in our new system installation:
Set our timezone accordingly. (I live in Chicago.):
And set the time to the standard UTC:
Because we’ve encrypted our root disk, we need to make sure the kernel loadsthe proper modules to decrypt it on startup. Otherwise we won’t be able to bootinto our installation.
vi into /etc/mkinitcpio.conf and add the necessaryhooks so the HOOKS line looks like this:
Free Apps For Macbook
Now we need to regenerate the initramfs image:
So that Internet will work on reboot, we need to enable the dhcpcd service.We’re going to keep using the ethernet-USB adapter for right now. We’ll getwireless setup later.
Get the name of the ethernet interface:
It should be
enp -something. With that, enable the service:
Finally, let’s configure the machine’s hostname. You can change
arch_mbp towhatever:
Add this hostname to the list of hosts.
vi into /etc/hosts and edit so itlooks something like this:
Boot Loader
Now we need to let the boot loader know where to find our new Arch Linuxinstallation. Best mac menu bar apps 2016. Gummiboot is a nice, simple boot loader. Let’s install it:
Setup the loader to default to arch and set the number of seconds to timeout inthe file
/boot/loader/loader.conf :
Make sure the correct boot partition (
/dev/sda1 in my case) is mounted on/boot by running:
Now we’re going to create an entry called
/boot/loader/entries/arch.conf thatlooks like this:
Check the boot tree with
tree /boot/ (If tree isn’t installed, install itwith pacman -S tree ). It should look something like this:
Now we can install gummiboot:
An Alternative Boot Loader Method
There are lots of suggestions floating out in the Interwebs about using rEFItor rEFInd or some bootloaders like that for Macs. Perhaps with older Macsthat’s necessary, but the default EFI bootloader on my MacBook seems torecognize Linux just fine. I’ve installed gummiboot on the original /bootpartition, following Loïc Pefferkorn’sblog.
However, in previous GNU/Linux installations, I didn’t want to mess with mydefault /boot partition. So, I actually created a third partition (in additionto the /root and /home partitions) as a /boot partition (but I didn’t encryptthat one—I didn’t feel like dealing with that mess of decrypting beforestarting the boot sequence).
That worked fine. Most GNU/Linux installations will install gummiboot or GRUBon the /boot partition you create for it. When you boot up, you can hold downthe alt/option key to go to Apple’s boot image selection screen. Your Linux/boot drive should show up there. You can also later use
efibootmgr to set itso Linux will be the default.
Reboot into New Installation
Before rebooting, set the root password:
Let’s leave the chroot environment we used for the install:
You can umount and close the encrypted volume:
It’s not a bad idea to just double check the encryption to make sure it opensand mounts properly:
If all goes accordingly, you can unmount and close the encryption again. And…
Setting Up Users
On reboot you should be greeted with the gummiboot menu. After selecting Arch(or waiting for it to timeout), you should be prompted for your password todecrypt the drive, and then it should boot into the console.
The first thing I like to do is create a new user and set the user’s passwordso I’m not operating as root:
This will create the user michael, add him to the group wheel, create a homedirectory under
/home/michael/ and make his default shell bash (I preferfish, but I’ll change that later).
I still need to run as root, though. Because I’ve added michael to the groupwheel, I can grant the wheel group sudo privileges. Run:
And uncomment the following line so it looks like so:
Now you can exit out of your root installation and login under the user youjust created.
A note about commands: You may have noticed that the commands I’ve writtenabove after rebooting have been prefixed with a
# . Now that we’re dealingwith a mixed-user environment, that symbol means you’ll need to be root or haveescalated privileges to run the command. If you’re not logged in as root (andhopefully you aren’t), you’ll need to prefix all the commands beginning with# with sudo . If I begin a command with $ , that means a regular,non-sudoer user can run it.
Get Your AUR Helper Up and Running
We’re now going to be installing a bunch of things. At the beginning here, mosteverything will be included in Arch’s repositories. As time goes on, though,we’ll need to install some packages from the user-supported AUR. You canmaintain AUR package installations manually, but I like a helper to help memanage them. I use
yaourt because it’s easy to install, takes the same optional flags as pacman , andhas done me well so far.
You need to use the “official” and manual way of installing AUR packages to getyaourt installed. It also requires
package-query from the AUR, so we’re goingto install that first.
I like to create a directory in my home folder just for building things. (Makesure you’re in your home folder first.)
Now we’re going to download the
package-query package, unarchive it, andchange into its directory:
Within the package’s folder, we’re going to run the following to build it:
This will run as your regular user only asking you for your root password ifnecessary.
With the package made, we can install it via
pacman :
Now we’ll do the same for
yaourt :
From now on you can use
pacman and yaourt interchangeably … for the mostpart. yaourt will install Arch repository packages and AUR packages.pacman , though, will only install Arch repository packages.
Let’s Get a GUI
While I’ve grown to love the console more and more, a graphical interface isnice. In this section, we’re going to get X, Cinnamon, and various GUIapplications up and running, along with wireless.
I tend to lump
pacman installations into pseudo-groups. I don’t really knowwhy; I just do it this way. You could probably do one huge pacman -S if youwanted it, but I’ll break it up a bit.
X and Video Drivers
As this is going to be a graphical interface, we need are graphics card up andrunning with the proper drivers. Luckily this machine uses Intel graphics, andIntel is pretty good about providing Linux (and sometimes open-source) drivers.
The
-S flag tells pacman to install the subsequent packages listed. (Again,you can use yaourt if you’d like here.) This will install the Intel videodriver, the Mesa OpenGL graphics library, and video acceleration API for Intel.It’ll likely ask you to install additional dependencies. Get all thedependencies!
With the necessary drivers installed, we can get Xorg (or the X Window System)installed.
I like to install the utilities, too, because there are at least a couple I’lluse later (either in this guide or another) that are helpful in improving HiDPIsupport for the MacBook’s Retina display.
Touchpad Support
You’ll probably want to use your MacBook’s touchpad when you have a GUI. Thesimplest driver is the synaptics driver:
The following config at
/etc/X11/xorg.conf.d/50-synaptics.conf works well forme:
Alternatively, there is the mtrack driver that I’ve been playing around with abit. It’s newer and there’s definitely some kinks that still need to be workedout: scrolling isn’t particularly smooth, palm detection can be a bit spotty,and tapping can sometimes not register, but it does have multi-touch if youcare about that. If you want to give it a try, install this instead of thesynaptics driver:
This is the current state of my config file for it at
/etc/X11/xorg.conf.d/10-mtrack.conf :
Display Manager
Now we need a display manager, which will ease the login process, managesessions, and automate the starting/stopping of the X server. They’re veryhandy things. GDM, the GNOME Dispaly Manager, has the best HiDPI support out ofthe box I’ve seen. But it’ll make you install the entire GNOME desktopenvironment. I don’t want that. There’s MDM, the Linux Mint display manager,which is a fork of GDM 2. However, I haven’t had a lot of luck with it on Arch.The default config file doesn’t seem very sane, and I haven’t had the time toreally pick through it and really understand.
So … I go with LightDM. You can tweak it easily enough to be decent on theRetina display. It’s fast and seems to do a great job at its tasks.
And now the first foray into systemd. We also need to enable LightDM so it’llautomatically start next time we boot up.
Desktop Environment
It’s time to get Cinnamon installed. Simply run the following:
That’ll pull in a lot more dependencies, too. Gotta get them all!
Some GUI Applications
That’s really all you need. If you reboot again, you should be greeted withLightDM’s login screen. Logging in will take you to the Cinnamon desktop.
However, before doing that I like to install a few more things while I’m at it.First is several applications that I know I’ll be using right off the bat.
I’ll leave it at that for now. That should draw in a lot more dependencies thatwill be handy to have.
I also like installing fonts now so they’ll be available for me right away tostart customizing the interface. These are my favorites:
Note the
ttf-linux-libertine-g and notttf-linux-libertine . You need thegraphite version of Linux Libertine to work with LibreOffice. I won’t go intohere why that’s the case.
I also like Google’s Noto font for the interface, but it’s only available viathe AUR:
Changing User’s Shell
As mentioned earlier, I prefer the fish shell over bash. So, let’s installthat:
We can now make that the default shell for the current user (michael):
The next time we login, our shell should be fish instead of bash.
Getting Wireless Working
Before rebooting into our lovely new GUI, let’s get wireless setup to work whenwe reboot.
This particular machine has the Broadcom BCM4360 wireless chipset. Broadcom hasbeen pretty mixed in the FLOSS support it seems. The BCM4360 is not supportedby the kernel itself, so we’ll need to use Broadcom’s non-free, non-opendriver:
broadcom-wl . I actually don’t think this even officially supports theBCM4360 chipset, but it works well enough. We’ll need to install the AURpackage:
And activate the kernel module:
NB: If you update to a newer kernel in the future, you may need touninstall and reinstall the
broadcom-wl package so it updates with the newlinux-header.
Cinnamon (unlike GNOME) does not automatically start the necessary services forwireless to work on startup. (It took me a long time to figure that out.) So,we need to stop the dhcpcd service we were using for the ethernet and start theNetwork Manager service. Keeping both running can cause conflicts.
Done!
Now when you reboot, you should be all set to go start customizing to yourheart’s content, adding applications as you’d like, and playing around withyour new Arch Linux box with Cinnamon.
Fine-tuning Power Settings
Another thing I’m often trying to get just right are the power settings. I’veseen several things online and have tried many of the suggestions. Some worked,some didn’t. Here’s what I ended up using.
I should note that this still isn’t perfect. My MacBook definitely runs coolernow, and battery life seems a bit better. I usually get about 6 hours on acharge. On OS X I got about 8, so it’s not too bad. Still room for improvement,though.
One thing that doesn’t work very well now is suspend. It seemed to work justfine before all my power setting tunings, so I imagine something is gettingflagged and restarted when the system tries to suspend and is preventing it. Ijust haven’t figured out what that is yet.
How To Make App On Mac Book Archived
One more thing: If you Google MacBook Pro and Arch Linux you’ll probably readsome things about disabling ACPI interrupts that were causing overheating andhigh CPU usage. If you have updated to the latest version of OS X 10.10“Yosemite” then you should be OK. The interrupt gpe4e still is a little highfor me, but disabling it seemed to cause issues when closing the lid so I’veleft it as is.
Powertop
The first tool I use is
powertop :
You may want to put your laptop on battery power and calibrate powertop:
That’ll cause the screen to blackout from time to time. Just let it run. Ittakes a few minutes then your screen will come back on.
You can create a systemd service that will start powertop’s autotune settingson startup.
And enable it to automatically start at boot time:
Thermald
Intel provides a daemon that will keep tabs on the CPUs’ temperature and adjustsettings to keep it from getting too hot.
Cpupower
Another utility that will help with CPU frequency scaling is cpupower:
While the CPU in my machine is 2.6GHz, it can turbo up to 3.1GHz. The Linuxkernel seems to like to ramp it up to 3.1Ghz even when idling. I don’t knowwhy. So, I’ve used cpupower to limit the CPU’s max speed. My cpupower configfile at
/etc/default/cpupower has the following two lines uncommented:
Fan Control
Finally, the kernel doesn’t seem to have very fine control over the MacBook’sfan. The following script helps add fine-tuning for the fan that willincrease its baseline speed and ramp it up gently, so it’s not anall-or-nothing kind of setup.
By default the service runs in verbose mode which adds tons of output to thesystem journal. It basically works by measuring the CPU temp, adjusting the fanspeed accordingly, and then sleeping for a given number of seconds. Withverbose mode on, it logs its wakeup every few seconds. That means a lot ofwriting to the journal. So I changed the service under
/usr/lib/systemd/system/mbpfan.service so the following line reads like so:
HiDPI (Retina) Support
For the most part things work pretty well, especially any GTK+ 3 applications.There are just a couple things I’ve tweaked to make more applications betterDPI-aware.
X Server
First is getting the X Server to be aware of the higher DPI. If you run thefollowing (this is why I installed xorg-server-utils earlier):
You’ll probably see that the resolution is set to 92x92 dots per inch. That’snot right! You can force a higher DPI using
xrandr . I just have Cinnamon runit as a startup application. Under System Settings > Startup Application clickAdd and create a startup application like this:
Qt 5
While GTK+ 3 applications work fine, there’s not much to be done about GTK+ 2programs. The story is similar with the Qt framework. Qt 4 applications willgenerally adjust the font size accordingly, but icons will be really tiny.Mendeley is a good example of this.
With Qt 5, though, you can do some extra tweaking. Create a file called
/etc/profile.d/qt-hidpi.sh and put the following line in it:
LightDM
You can at least increase the font size of the LightDM login screen byuncommenting and editing the following line in
/etc/lightdm/lightdm-gtk-greeter.conf :
LibreOffice
In the latest release of LibreOffice (version 5.0), they updated the rendererthey used. This seems to make the icons and text blurry while in previousversions it was fine. You can default to the GTK backend by editing
/etc/profile.d/libreoffice-fresh.sh and uncommenting the line:
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |