DEV Community

Cover image for How to setup Manjaro Linux i3 on a Macbook Pro
Víctor Adrián
Víctor Adrián

Posted on • Originally published at lobotuerto.com on

How to setup Manjaro Linux i3 on a Macbook Pro


You can check the latest updated version of this article at lobotuerto's notes - How to setup Manjaro Linux i3 on a Macbook Pro.


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

  • Direct downloads and checksums: here.
  • Torrent downloads: 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 unreadable 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 you are at it, click on the Encrypt system checkbox and pick a nice and long passphrase for it, then click through the install wizard and wait for it to be finished with the installation process.

Configuration

HighDPI screen

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

Check the supported modes (resolutions) for your screen with:

xrandr
Enter fullscreen mode Exit fullscreen mode

If the initial DPI is too much for you —it is for me— try a couple of 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
Enter fullscreen mode Exit fullscreen mode

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

exec --no-startup-id xrandr --output eDP1 --mode 1680x1050
Enter fullscreen mode Exit fullscreen mode

Keyboard

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

Let’s swap the Alt and Cmd keys out.

With immediate effect:

echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd
Enter fullscreen mode Exit fullscreen mode

To make it permanent:

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

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
Enter fullscreen mode Exit fullscreen mode

To make it permanent:

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

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
Enter fullscreen mode Exit fullscreen mode

SSD

If you have an SSD, you can activate a periodic TRIM operation that’ll run by default on a weekly basis with:

sudo systemctl enable --now fstrim.timer
Enter fullscreen mode Exit fullscreen mode

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

UFW

Activate the firewall service at boot with:

sudo ufw enable
sudo systemctl enable --now ufw.service
Enter fullscreen mode Exit fullscreen mode

SSH

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

sudo ufw allow SSH
Enter fullscreen mode Exit fullscreen mode

Modify and uncomment the following lines in /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no
Enter fullscreen mode Exit fullscreen mode

Enable the SSH service:

sudo systemctl enable --now sshd.service
Enter fullscreen mode Exit fullscreen mode

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

sudo systemctl restart sshd.service
Enter fullscreen mode Exit fullscreen mode

WiFi

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

First, let’s generate a ranked mirror list, then update the package databases:

sudo pacman-mirrors --geoip
sudo pacman -Syy
Enter fullscreen mode Exit fullscreen mode

In case you want to tweak it, the list of mirrors can be found here: /etc/pacman.d/mirrorlist.

To upgrade your installed packages:

sudo pacman -Su
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 '
Enter fullscreen mode Exit fullscreen mode

You might be able to force WiFi activation with this:

sudo modprobe wl --force-vermagic
Enter fullscreen mode Exit fullscreen mode

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 we’ll be good.

Edit this file:

sudo nano /etc/modprobe.d/alsa-base.conf
Enter fullscreen mode Exit fullscreen mode

And put inside:

options snd_hda_intel enable=1 index=0
options snd_hda_intel enable=1 index=1
Enter fullscreen mode Exit fullscreen mode

Install pulseaudio and pavucontrol:

sudo pacman -S pulseaudio pavucontrol
Enter fullscreen mode Exit fullscreen mode

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

bindsym XF86AudioMute exec --no-startup-id amixer -D pulse sset Master toggle
Enter fullscreen mode Exit fullscreen mode

This one requires a system restart.

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

Daily usage

Copy & pasting

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

Software

Utils

sudo pacman -S calibre namcap pacaur redshift
Enter fullscreen mode Exit fullscreen mode

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

exec --no-startup-id redshift
Enter fullscreen mode Exit fullscreen mode

Don’t know what redshift is?

File manager

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

sudo pacman -S thunar
Enter fullscreen mode Exit fullscreen mode

Browsers

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/
Enter fullscreen mode Exit fullscreen mode

If you want to install the other two —Firefox and Google Chrome:

sudo pacman -S firefox
pacaur -S google-chrome
Enter fullscreen mode Exit fullscreen mode

Code editor

pacaur -S visual-studio-code-bin
Enter fullscreen mode Exit fullscreen mode

Network service discovery

This is useful if you have a network printer:

sudo systemctl enable --now avahi-daemon.service
Enter fullscreen mode Exit fullscreen mode

Now CUPS should detect it without problems.

Go to this URL http://localhost:631, and add your network printer over there!

Daily workflow ready?

Definitely yes!

Links

Top comments (2)

Collapse
 
iridakos profile image
Lazarus Lazaridis

Great walkthrough, thanks!

Collapse
 
pracsolve profile image
Anurag Rajput

Nice Article.

Also check out a method to Install a Persistent and Portable Manjaro Linux on a Flash Drive at techsolveprac.com/manjaro-on-flash...