Dual Boot Happy Hacking Linux and Mac OS

Written by azerbike | Published 2017/07/27
Tech Story Tags: linux

TLDRvia the TL;DR App

An Introduction of Happy Hacking Linux and A Step by Step Guide on How to Install It On A Macbook

The Story

Last December, I created a new Linux distro called Happy Hacking Linux, specifically for developers who need fast, minimalist system that has good package systems. Arch Linux has been my favorite distro for past 10 years, because it lets you build your system by yourself, and gives more than 55.000 packages in its official and community package registires.

So I took Arch Linux, changed the logo with a cat wearing sunglasses (my wife drew it for me), built a new installation wizard from scratch, and automated what many developers do; setting up users, fonts, network, Xmonad desktop with default config, etc… This new installer is created using command-line dialogs, but it’s smart enough to detect if user is on a Macbook. It automatically sets up wifi, audio, also configures screen brightness, keyboard backlight buttons so you don’t have to.

More than 8 months, I’ve been using this distro and had really good experience with it. For example, I could turn my father’s old computer into a fast development machine in 30 minutes and create a new homepage same day. When my 2013 Macbook Air got very slow after updates, I could install Happy Hacking Linux and do my work without all that distraction that slows me down. Plus, I have access to 60k packages in two different registries, when Brew on Mac only got about 5000 packages in its ecosystem.

In the rest of the article, I’ll explain how to install Happy Hacking Linux on a Macbook, for people who want to keep Mac OS.

How to Dual Boot ?

It’s pretty straightforward to setup a Mac for dual-boot. Here are the steps with links to how-to sources;

  1. Disable System Integrity Protection
  2. Download rEFInd
  3. Install rEFInd & Create Partition for Linux
  4. Install Happy Hacking Linux Boot Theme

Create Installation Stick

Step by step;

  1. Download latest version
  2. Plug a USB stick in your computer.
  3. Unplug all other USB sticks & external disks. If you accidentally choose the wrong disk, you may lose valuable data.
  4. Running diskutil listcommand to figure out the path of your USB stick. Verify you found the correct path, because running dd on that path will destroy all the data inside.
  5. Now, write the ISO into the USB stick by running this command;sudo dd if=path/to/happyhacking.iso of=/dev/rdiskX bs=1m

Done! Now you’re ready to start installing Happy Hacking Linux!

Installation

Once the USB stick is ready, keep it plugged and reboot your system. rEFInd should show options to boot bunch of Linux installers, choose the second Linux option, and wait until you see the blue screen asking your name.

The first steps of the installation will ask you to choose a username, and also a Git repo where you keep your dotfiles (make sure it’s public). A part of the installation, your dotfiles will be automatically linked in the home directory.

After that, you’ll be asked to choose Wi-Fi network via nmtui connect command. If you don’t see the network you’re looking for in that list, press Quit button until the network shows up.

The next step is partition, where you need to carefully select the partition that will be formatted. For dual-boot, choose cfdisk and create a single Linux partition. Note the path of that partition, because next dialog will ask you to type it. In my case, it was sda4so I typed /dev/sda4 to the prompt asking me where to mount / (root) system.

Rest of the installation is quite simple, the wizard configure users and permissions, install drivers, packages, a wallpaper from Unsplash, it’ll automatically detect your timezone and migrate your Wi-Fi connection so you’ll be automatically connected when you first boot up the system.

When you’re asked to override the existing boot, choose the No answer as we don’t want to override rEFInd boot.

If you got a post-install.sh file in your dotfiles repo, it’ll be executed by the installer, so you can customize the installation. With an average wi-fi speed, installation should take about 30 minutes. If things go wrong, you can exit the installer by pressing Control-Cand continue installation by running /usr/local/installer/installer.sh script.

Once the installer tells you installation is done, exit the installer and type reboot to restart your system.

Choose the cat logo in the boot menu, type your username (you specified it in the first step of installation) and password, viola!

Here is the default desktop you’ll see;

The default Happy Hacking Linux Desktop Screen

First Steps

For those not familiar with Xmonad, I’ll briefly explain how to start using it. There are five important keyboard shourtcuts;

  1. ⌘-Shift-Space: Opens a new terminal
  2. ⌘-P: Opens dmenu, so you can launch a program
  3. ⌘-Shift-C: Closes the focused window
  4. ⌘-Space: Changes the window layout
  5. ⌘-J - ⌘-K: Switch between windows.

After a fresh installation, here is the steps for installing Google Chrome (or Firefox);

  • Open up a new terminal (⌘-Shift-Space)
  • Run pacman -S chromium (or firefox)
  • Once it’s done, hit ⌘-P and open chromium
  • Switch to WWW workspace (⌘-S or ⌘-2)

Workspaces

Happy Hacking Linux has 3 named workspaces, 6 numbered workspaces. The named workspaces are;

  1. Home (⌘-1 or ⌘-d)
  2. WWW (⌘-2 or ⌘-s)
  3. Code (⌘-a or ⌘-3)

Browsers will open up in WWW workspace automatically. Emacs will open up in the Code workspace. You can modify this behavior by editing ~/.xmonad/xmonad.hs file. Don’t forget recompiling the config by running xmonad — recompile and you can always restart Xmonad by pressing ⌘-Q.

Coding

I do all my work on a 11" Macbook Air with small screen, and tiling window managers help me to maximize my usage of the screen. Here are some helpful shortcuts I use for coding;

  • Remove Borders: ⌘-b
  • Toggle Top Bar: ⌘-o

Happy Hacking Linux comes with a specific workspace for coding, with a fixed Mirror Tall layout by default. This layout is perfect for having the editor on top, having the terminal on the bottom.

Although WWW workspace is only dedicated for web browsing, you can do live frontend coding there. Whenever I need to change the front-end code, I move my editor to WWW workspace pressing ⌘-Shift-2 , split the window to three parts; the browser, inspector and the editor.

Xmonad Helps You Manage The Windows Easily

Final Words

For more information, check out the videos and other documentation in the homepage. If you need help, you can join our Slack channel. I’m also on Twitter, you can send me a message there.

Cheers

Azer


Published by HackerNoon on 2017/07/27