Introduction

I have laid my eyes on a new distribution that bakes in i3 with it: Manjaro Linux i3 Community Edition.

It has some rough edges, but I’m pretty sure they’ll be ironed out rather sooner than later, given Manjaro’s rise in popularity.

What I can say is that Manjaro Linux feels nimble and agile, meanwhile Ubuntu starts to feel bloated and sluggish.

So, what follows is a very opinionated guide for installing Manjaro Linux on a MacBook Pro from Mid 2014, and leave it in a perfect state for desktop and software development usage —kind of what I currently have in Ubuntu.

Still on the quest for a perfect OS. Let’s start!

Download

  • Manjaro Linux all versions: here.
  • Manjaro Linux i3: here.

Preparing the live USB

You need another Linux machine, or a way to make a Manjaro Linux live USB stick.

Once you have downloaded the .iso image you can follow these instructions to prepare the USB drive.

Booting from USB

Turn off your machine, insert the USB drive, then turn it on, and as you hear the distinctive sound when it starts, press and hold the alt key until a boot menu appears. Select the one that says EFI.

You’ll be presented with a preconfiguration screen. Select your timezone, keyboard distribution, language, free drivers, then: Boot: manjaro.x86…

Installation

You’ll be presented with a dialog with many buttons, click on the one that says: Launch installer.

You might see a couple of warnings, they usually are about:

  • The machine is not connected to a power source.
  • The machine is not connected to the Internet.

When you get to Partitions select Erase disk to get rid of everything on that Mac. Don’t worry you’ll always be able to recover OSX if you really want to —but not your data though, so be careful!

While still there, you can enable FDE (Full Disk Encryption) by clicking on the Encrypt system checkbox and picking a nice and long passphrase for it.

Then just click through the install wizard and wait for it to finish the installation process.

Configuration

Fix your High-DPI screen

The first thing to do is to improve our ability to read that super small text on the terminal.

Check the supported modes —AKA resolutions— for your screen with:

xrandr

If the initial DPI is too much for you —as it is for me— try a couple of other resolutions and see what you feel comfortable with. In my case I usually settle with 1680x1050 or 1400x900.

Try them out like this:

xrandr --output eDP1 --mode 1680x1050

To make this permanent, edit ~/.i3/config and add this line at the end:

exec --no-startup-id xrandr --output eDP1 --mode 1680x1050

Network

Setup your DNSs to Google Public DNS:

  • IPV4: 8.8.8.8, 8.8.4.4.
  • IPV6: 2001:4860:4860::8888, 2001:4860:4860::8844.

i3 config file

If you don’t want to have an i3 binding that opens a PDF help file, then comment out this line in ~/.i3/config:

# bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf

I think these are better values for gaps:

gaps inner 2
gaps outer 0

UFW

Activate the firewall service at boot with:

sudo ufw enable
sudo systemctl enable --now ufw.service

Browsers

At this point you probably want to get into a browser to read / follow some configuration guides.

This distro comes with the Pale Moon browser. I tried it out, didn’t like it.
To get rid of it:

sudo pacman -Rs palemoon-bin
rm -rf ~/.moonchild\ productions/

Now, to install anything, first we need to generate a ranked mirror list then update the package databases:

sudo pacman-mirrors --geoip
sudo pacman -Syy

If you want to tweak the ranked mirror list, you can find it here: /etc/pacman.d/mirrorlist.

To upgrade your installed packages:

sudo pacman -Su

Now, to install the big two —Firefox and Google Chrome:

sudo pacman -S firefox namcap
yaourt -S google-chrome

.bashrc

In a terminal:

# leave a space before custom configuration
echo "" >> ~/.bashrc
# convenient list command
echo "alias ll='ls -lhF'" >> ~/.bashrc
# same as before, but show hidden files
echo "alias la='ls -lahF'" >> ~/.bashrc

Keyboard

Second on the list of annoyances is the keyboard, since I like to move fast on my i3 desktop environment, swapped out keys don’t help, let’s fix that.

Swap Alt and Cmd keys

Let’s swap the Alt and Cmd keys out.
With immediate effect:

echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd

To make it permanent:

echo options hid_apple swap_opt_cmd=1 | \
sudo tee -a /etc/modprobe.d/hid_apple.conf

Swap Multimedia keys and Function keys

Let’s enable function keys (f1, f2, f3…) by default —instead of default multimedia keys.
With immediate effect:

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

To make it permanent:

echo options hid_apple fnmode=2 | \
sudo tee -a /etc/modprobe.d/hid_apple.conf

GRUB

I usually remove the quiet option from grub in /etc/default/grub.
I like my startup process noisy.

If you edit the grub file, don’t forget to:

sudo update-grub

Change Linux kernel version

Do you want to try out the 4.17.0-1 kernel version?
Then, execute:

manjaro-settings-manager

Trim SSD storage

If you have an SSD and you didn’t enable FDE (Full Disk Encryption) when installing, you can activate a periodic TRIM operation that’ll run by default on a weekly basis with:

sudo systemctl enable --now fstrim.timer

It’s based on the timestamp of: /var/lib/systemd/timers/stamp-fstrim.timer.

Generate a new SSH key

If you don’t have an SSH key in ~/.ssh, you can create one with:

ssh-keygen -t rsa -b 4096 -o -C "user@some-place"

SSH service

If you want to allow incoming SSH connections through the firewall, try with this:

sudo ufw allow SSH

Enable the SSH service:

sudo systemctl enable --now sshd.service

You can now ssh-copy-id a key from another machine.

After that initial setup, harden your security by uncommenting and modifying the following lines in /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no

If you ever modify the /etc/ssh/sshd_config file, restart the SSH service with:

sudo systemctl restart sshd.service

WiFi

I solved this by first connecting through an USB-Ethernet adapter cable —this one has worked great so far.

Find out which kernel version you have installed with uname -a.

Then let’s install the appropriate headers and driver:

sudo pacman -S linux-headers broadcom-wl-dkms

In my case, I selected the linux414-headers.

Let’s restart to try out our configs so far!

You should be able to use WiFi now.

If you don’t, and you see something like this in your journalctl -b logs:

kernel: wl: version magic '4.14.15-1-MANJARO SMP preempt mod_unload modversions retpoline ' should be '4.14.15-1-MANJARO SMP preempt mod_unload modversions '

You might be able to force WiFi activation with this:

sudo modprobe wl --force-vermagic

It worked just fine over here.

Sound

This came as a surprise, sound is not working out of the box.
The good news is: It only requires some tweaking and it’ll be good to go.

Edit this file:

sudo nano /etc/modprobe.d/alsa-base.conf

And put inside:

options snd_hda_intel enable=1 index=0
options snd_hda_intel enable=1 index=1

Install pulseaudio and pavucontrol:

sudo pacman -S pulseaudio pavucontrol

Also, the mute key works OK for muting, but pressing it again won’t un-mute your sound card.
To fix it, add this at the end of your ~/.i3/config:

bindsym XF86AudioMute exec --no-startup-id amixer -D pulse sset Master toggle

This one requires a system restart.

After rebooting, you should have sound coming out from your computer, and a working set of multimedia keys.

Day-to-day activities

Copy & paste

You can paste stuff using a 3-finger touch/click on the trackpad.

Or, since the default terminal is Urxvt, you can copy with Ctrl+Shift+C and paste with Ctrl+Shift+V.

Change desktop appearance

Maybe you don’t like the dark theme stuff from the default installation. No problem.
Try with this:

lxappearance

Desktop software

If you miss the cozy space of a file manager, you can get a good one with Thunar.

sudo pacman -S inkscape libreoffice-fresh gnote calibre openshot \
thunar clementine simple-scan redshift python-gobject python-xdg \
youtube-dl feh cups unzip

To execute redshift on init, edit ~/.i3/config and add this line at the end:

exec --no-startup-id redshift

Don’t know what redshift is? Have a look here.

Printing

To enable CUPS and access to http://localhost:631:

sudo systemctl enable --now org.cups.cupsd.service

Network service discovery

This is useful if you have a network printer:

sudo systemctl enable --now avahi-daemon.service

Now CUPS should detect it without problems.
Go to this URL http://localhost:631, and add your network printer over there!

Software development

Here are some links to tools I use on a daily basis to write software:

Code editor

One code editor to rule them all…
Visual Studio Code is fast, nimble, agile and beautiful.

yaourt -S visual-studio-code-bin

Developer utils

Miscellaneous stuff I require in my day-to-day developer activities…

sudo pacman -S hugo inotify-tools wkhtmltopdf wxgtk ansible

Git diff colors

Default terminal colors for Git diffs sucks:

Default diff colors

To fix them, and upgrade Urxvt’s default behavior add these lines at the end of your ~/.Xresources file:

! CUSTOM STUFF

! do not scroll with output
URxvt*scrollTtyOutput: false

! scroll in relation to buffer (with mouse scroll or Shift+Page Up)
URxvt*scrollWithBuffer: true

! scroll back to the bottom on keypress
URxvt*scrollTtyKeypress: true

! scrollback buffer in secondary screen
URxvt.secondaryScreen: true
URxvt.secondaryScroll: false

! magenta cursor color
URxvt.cursorColor: magenta

! load solarized dark theme
#include "Xresources.dark"

Now, download Xresources.dark from here and put it in your $HOME directory.
Then modify these lines in it:

!! black dark/light
*color0:                S_base02
*color8:                magenta !!S_base03 => this is commented out!

To make changes effective:

xrdb ~/.Xresources

Finally, close your current terminal and open a new one.
Now your Git diffs will look like this:

New diff colors

Much better! If you ask me… ;)

Daily workflow ready?

Definitely yes!

Links


— lt

Feedback & comments

Get in touch on Twitter

Or by good ol' email at adriandcs@gmail.com