[Part I] Switching from Linux to Mac
Tags: webdev, linux, mac
Published: 2021-04-05 16:21:44

# Intro

In this article, I am sharing my personal experience on switching over from Linux to Mac. I will compare both of them in terms of the 3 aspects below, and for each section, I will share what apps or software I am using for both Linux and Mac.

1. *Window manager*
2. *Daily usage*
3. *Development machine*

Some of you might ask, *but why the switch*? To be honest, the switch is mainly personal. I have always wanted to own a Macbook, but couldn't afford one before this. Kudos to Linux and the community, as an open-source operating system, I have benefited a lot from it for **free**. I have used it to learn to program and landed myself a web developer job, which I continue to use as my working machine until late 2020. Again, this switch is mainly personal, and I still love Linux very much.


## Window Manager

A little background before diving in, I have been using a Linux machine since 2018 until I bought myself a MacBook Pro in November 2020. The reason why I am comparing window managers here is that I am deeply in love with working on my Linux machine using [i3](https://i3wm.org), a tiling window manager. I will say that this is the most important factor affecting my buying decision on a laptop. Therefore, I did quite some research on whether the Mac environment offers anything similar. After some intense study, I found [yabai](https://github.com/koekeishiya/yabai), a tiling window manager for macOS. I thought of trying it first on a virtual machine, but unfortunately, I couldn't get it to work. So, I made the buying decision solely based on studying through the GitHub repository, Reddit discussions, and YouTube videos. 

Of course, yabai is the first thing I installed when my Macbook arrived. The installation is pretty straightforward and well [documented](https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)). Differ from i3, I need to install a hotkey daemon, I am using [skhd](https://github.com/koekeishiya/skhd), to set all the key bindings. All these key bindings are used to interact with the tiling window manager. 

To give you guys a better picture of my setup and my working flow. I am using 2 displays with 5 desktops on each of them. Very frequently I will have 2 apps opening on the same desktop which are tilled properly thanks to yabai. Another thing I want to clarify here is that I am a VIM addict so I don't really use my mouse or touchpad much (although the touchpad on Mac is really great). Therefore, I am really looking for a tiling window manager that allows me to do all of these below using only the keyboard:

1. *Switch focus to the desired desktop on multiple displays*
2. *Switch focus to different windows (opened apps) in the same desktop*
3. *Toggle fullscreen on a tilled window*
4. *Moving window from one desktop to another* 

I am very happy that yabai + skhd is able to do everything above and it is so customizable that I have customized all the key bindings to match what I was using in i3. Although yabai is still missing some features that are available in i3, I find it good enough to mimic my working flow in i3. The only thing that has been annoying me is that sometimes the focus of a window is switched wrongly (at least not what I am expecting) after killing another window. I have found related issues on yabai GitHub repo, tried editing the config file using the suggestions, but it still happens sometimes. Probably I should give it another look since I have last updated my config file a few months ago. I appreciate comments if anyone reading this has a similar problem and is managed to fix it.

Overall, yabai is a really good alternative to i3. I managed to set it up to reproduce almost 90% of my working flow on a Linux machine with i3. This is getting a little too long, so I will break them down into 3 parts. I will follow up with another 2 parts talking about the experience of using both Mac and Linux for *day to day usage* and as a *development machine* some days later. Thank you for reading this far!