The one about working with macOS being a Linux user

How to configure the system in the pursuit of happiness

I will start with an unpopular opinion: I hate macOS and I hate Apple.

TL;DR

Next I will explain my reasons behind that unpopular opinion.

In case you are not interested in my opinion or simply want to see what I did as a Linux user to (kind of) happily work with macOS, you can jump directly to the part where I share my configuration.

My reasons

The way I see it, Apple is a company that simply sells overpriced products, although usually are products with very good quality. I'll give them that.

Honestly, I will never understand what all the fuss is about, especially in the tech industry.

As a software developer, I don't get why so many tech companies force you to work with macOS, instead of asking you what operating system do you prefer to be more productive.

In fact, lots of them include working with a MacBook in their job offers as if it were a perk. Seriously? I guess they think it's really cool to have a bitten apple on the lid of your laptop. However, most of the time for half the price you could get a laptop with similar features or even better, depending on the laptop we are talking about.

In my previous post, I talked about my new job. The consulting agency allowed me to choose between Windows and macOS. I chose Windows simply because I wanted to install Ubuntu and have a dual boot. Finally I didn't do it because they don't have support for Linux, but mainly because I don't need that laptop at all. I used it for a few weeks but right now it's kept in a drawer, where it will remain until the day I have to return it.

On the other hand, the end client I'm actually working on, an American fintech company, didn't give me the opportunity to choose. They send me a relatively old MacBook Air with the M1 chip. So everybody in the company works with macOS, whether they like it or not.

I get that for IT and security teams (probably among others) is easier that everybody uses the same operating system. I also get that not every tool is available for Linux systems. That being said, I think that there is an open source alternative for most of them.

Anyway, during my first day with my new team I shared my feelings about macOS and everybody said that at least it isn't Windows. I used to think that way too, but after using the Windows laptop I mentioned before for a few weeks with WSL I must say that the experience was better than I expected.

And don't get me wrong, I hate Windows too. But for different reasons.

I know, I know. I'm just another hater...

If you've reached this point, you might ask yourself why so much animosity. And that would be a fair question.

Focusing here exclusively on macOS, it's mainly because of what I consider an awful user experience (UX).

I have previous experience working with macOS in a few companies, so I know what I'm talking about. The frustration I've felt every day working with macOS is something I have rarely felt working with Linux for almost 20 years.

I use a lot of shortcuts and I find quite frustrating in macOS that most of them don't work or do something completely different to what I expect.

The obvious exception in Linux is ctrl+c and ctrl+v in the terminal, where is required to press shift key to make it work as expected. Definitely that was really confusing for me at the beginning.

Although almost every Linux distribution has its own desktop environment, package manager, etc., I love the feeling working with any of them. Everything works just fine from the start. Every shortcut works as I would expect. No frustration at all. And I think that is priceless.

Of course it's not perfect. Among other things, the support for some drivers in Linux is sometimes far from ideal, but I'm talking here about the overall user experience.

Although macOS came first (with another name), and cmd and ctrl keys had different purposes, Windows was the real game changer during the '90s. For that reason and despite my feelings about that operating system, I'm glad that Linux followed the Windows way without the cmd key, allowing a smoother experience for any kind of user that wanted to try a quite different operating system. And that's precisely the main reason I hate macOS: Almost nothing works as I would expect from the start.

And I haven't even mentioned Finder yet. What the hell is wrong with that file manager? Well, let's keep it there...

In my previous experiences working with macOS I assumed I would have to deal with the frustration. So every time I used a shortcut with ctrl that didn't work, I used exactly the same combination with cmd. If you are something like me, that would happen constantly. You can't be really productive that way, always thinking about the next shortcut.

But you can't simply remap ctrl and cmd keys between them, because some shortcuts are expected to work with ctrl anyway.

So this time I decided that to be more productive from the beginning I needed to work as close as possible to how I work in Linux.

My configuration

The macOS version is Sonoma 14.6.1.

The laptop with macOS comes with a U.S. keyboard layout. I didn't apply any remapping to it.

Recently I acquired a wireless keyboard with Spanish layout (Logitech ERGO K860) and a vertical mouse (Logitech MX Vertical), both connected via Bluetooth. As usual, everything works just fine without any configuration in Windows and Linux.

Keyboard

Go to System Settings -> Keyboard.

macOS keyboard system settings

Some combination of keys was constantly changing my input source so I changed following option:

Press fn key to -> Do nothing

In my case, I configured the Spanish input source during system installation, but if I hadn't, I would had to add it as follows:

Text Input -> Input sources -> Edit -> At the bottom left, click on + -> Search for Spanish -> Add

Add new input source in macOS

A few changes were made to the shortcuts:

Keyboard Shortcuts -> Missing Control -> Unfold "Mission Control"

Uncheck "Move left a space" and "Move right a space"

Those options are tied by default to ctrl key, but I prefer to use that key combination for navigation.

Keyboard missing control options

Keyboard Shortcuts -> Input Sources

Uncheck "Select the previous input source" and "Select next source in Input menu"

Keyboard input sources options

Keyboard Shortcuts -> Function Keys -> Enable "Use F1, F2, etc. keys as standard function keys"

Keyboard function keys

How that behaviour is disabled by default simply beats me.

Mouse

Go to System Settings -> Mouse -> Disable "Natural scrolling"

macOS mouse system settings

The default behavior doesn't feel natural at all to me. For that reason, I prefer the so-called reverse scrolling.

Karabiner-Elements

This great application allows to easily remap keys and shortcuts. Check the list of features if you are interested.

I added a custom profile, so I can apply my configuration whenever I want.

Karabiner-Elements app custom profile

I had to enable modify events for both the keyboard and the mouse. Otherwise the application won't be able to do the remapping properly.

Karabiner-Elements app devices

Simple modifications allow to interchange keys.

Karabiner-Elements app simple modifications

I only apply changes to the desired device, in this case to the external keyboard.

Important note:

System modifier keys configuration in System Settings -> Keyboard -> Keyboard Shortcuts -> Modifier Keys is ignored when you use Karabiner-Elements.

Complex modifications allow to create rules to make some shortcuts available under certain conditions.

Karabiner-Elements app complex modifications

Initially I used some predefined rules maintained by the community, but once I started getting how they work, I started creating my own rules.

Karabiner-Elements app custom rules

The event viewer comes in handy to confirm the name of each key and mouse button.

You can see the whole configuration on this gist.

Some modifications are only applied to specific applications, such as the terminal or the browser, and others are applied to all applications except the ones specified, usually VSCode.

Karabiner-EventViewer app

Terminal

The first thing I did was replacing the default terminal with iTerm2.

I added a custom profile in Settings -> Profiles -> At the bottom left, click on +.

iTerm2 app custom profile

Add the desired name and set it as default profile clicking on "Other Actions...", placed at the bottom.

The shell I use is ZSH, that is configured through my dotfiles.

iTerm2 app customized

The shortcuts I use on this terminal are defined in Karabiner-Elements, except for the command that allows to recover the last argument provided to the previous command executed, alt+.

I couldn't replicate that behavior with that application, so I had to find an alternative. For that I followed the instructions in the following comment on StackOverflow.

iTerm2 app custom key mapping

You can see the whole configuration on this gist.

Another command I use a lot in the terminal in Linux is ctrl+u that clears the entire current line from the cursor to the beginning of the line. The closest command I found in macOS with that purpose is ctrl+w, cleaning each word from the cursor to the beginning of the line. To get the same result you have to press the same shortcut multiple times. The remapping was made with Karabiner-Elements, of course.

I plan to add all the configuration of this terminal to my dotfiles so I can easily replicate it anywhere I need it.

VSCode

The editor (or IDE) is the application where I spend most of my time everyday, so this is the main source of my frustration working with macOS.

I reused my configuration for VSCodium in Linux, stored on my dotfiles.

However I had to change the font size following the instructions on this comment, because everything looks smaller in macOS.

Open the file that contains user configuration. You can access to that file in ~/Library/Application Support/Code/User/settings.json or pressing f1 and selecting "Open User Settings (JSON)".

The relevant configuration is as follows:

{
  "editor.fontSize": 13,
  "terminal.integrated.fontSize": 13,
  "window.zoomLevel": 0.6
}

After that, having all keyboard shortcuts configured the way I wanted would have been a daunting task if it were not for a wonderful project on GitHub that takes care of people like me.

Open the file that contains keyboard shortcuts. You can access to that file in ~/Library/Application Support/Code/User/keybindings.json or pressing f1 and selecting "Open Keyboard Shortcuts (JSON)".

At the top of that file I have all the custom shortcuts included in my dotfiles. Right below I pasted the negative shortcuts from macOS to remove all those shortcuts. Then I pasted the shortcuts from Linux.

In case of doubt, you can find more details about how to proceed in the README of the project.

I couldn't directly translate all shortcuts from Linux to macOS, so I had to remove some of them from the Linux section, customize them properly, and place them at the top of the file.

Besides, I wanted to remove other shortcuts that I don't need, so I added them right between the customized shortcuts and the negative shortcuts from macOS.

You can see the whole configuration on this gist.

It's worth to mention that in Karabiner-Elements I was remapping some shortcuts from ctrl to cmd, so I was unable to properly configure some shortcuts because VSCode was receiving cmd when certain shortcuts expected ctrl. I became aware of the issue thanks to the Record keys functionality. To avoid that I check in every custom rule that the modification does not affect VSCode.

Finder

IMHO probably the worst application in the whole macOS ecosystem. It goes hand in hand with Preview for such dubious honor.

When you press enter on a selected directory or file, then you can rename that element. Why not?

I made some changes in its settings:

  • Include the home directory in the sidebar
  • Show all filename extensions
  • Customize the toolbar (search, create new directory, move to trash, how to show items, item grouping, back/forward buttons)

Besides, some modifications made in Karabiner-Elements are focused on Finder:

  • enter to open a directory or file
  • f2 to rename a directory or file
  • ctrl+h to show/hide hidden files
  • delete_forward to move to trash a directory or file
  • delete_or_backspace to go back to the parent directory

Other generic modifications, such as ctrl+c and ctrl+v, are applied to Finder as well.

Other configurations

One of the shortcuts I use the most is alt+tab to navigate between all the open programs. The simplest solution to get that shortcut would be remapping it to cmd+tab, but I still couldn't see all the instances of any given program. At least by default.

That's something else to add to the never ending list of things I will never understand about macOS.

For that reason, I'm using AltTab application, that does exactly what I need, and even more. It allows a lot of customization to get the desired result.

AltTab app

I also move and resize windows constantly using shortcuts, so I've installed Rectangle app. Very nice and simple.

Rectangle app

Another essential application for me is the browser. In the last few years I have been using Google Chrome mainly, so I had to configure the shortcuts to which I am more used to. Again, some modifications made in Karabiner-Elements are focused on the browser:

  • ctrl+l to put the focus on the address bar
  • ctrl+d to save a bookmark
  • ctrl+shift+t to reopen a tab
  • ...

The work is far from done yet. Among other things, I'd like to be able to do the following with shortcuts:

  • Open a image and navigate between all images in the same directory with arrow keys
  • Close an image with escape
  • Display a dialog that would allow to suspend/sleep, restart or shutdown the computer
  • Select a directory or file and get the options available, similar to what you get with a right click of the mouse (or a button like in Linux)
  • Navigate between spaces
  • Easily move applications to different spaces

Last but not least, I have to update my dotfiles to include all this configuration.


Bear in mind that here I'm sharing my opinion and experience with macOS from the POV of a software developer that has been working and using Linux for most of my life. An operating system that is not as fancy as macOS is, but one that I consider way better and simpler to use. YMMV.

In any case, right now I have to work with macOS and hopefully I'm going to keep improving my UX to be a little bit happier every day (or at least less unhappy).

Are you an advanced macOS user and know another easier way to do what I'm doing? If so, please, share it because I'm quite interested in improving what I'm doing.

Thank you for reading and see you in the next one!