Using MacOS First Impressions
MacOS logo.
Introduction
I have been using Linux some 30 years now. Recently, I switched from Ubuntu to Debian.
I am a devoted Linux user. I have been using Linux at home and now some ten years also at work as my primary developer machine. Linux is a superb developer machine, for various reasons. I am not going to iterate the reasons here, but let’s just mention two of them: You can run docker natively, there is no need to run some Linux virtual machine on top of Mac or Windows to run docker Linux containers. Another good reason is that when you deploy something, usually you are deploying either Linux containers or Linux virtual images - there is a synergy benefit if your developer machine is also Linux.
But. For one peculiar reason I needed also either a Windows or a Mac machine for one specific job assignment. A Windows machine was out of the question, of course. Mac is based on BSD Unix, and therefore you can have at least a working bash shell with Mac. Nowadays Windows has this Windows Subsystem for Linux, but I have heard quite a lot of issues using it in a corporate environment (corporate Windows policy tools causes issues with Docker, etc.).
So, I got a Mac laptop. I have now spent two days configuring my corporate Mac, and in this blog post I tell you about some first impressions configuring a Mac machine for a Linux user.
Bash
First things first. When I got my Mac laptop, I started the terminal. The shell was not bash. Some googling, and I was able to switch the terminal shell to bash:
chsh -s /bin/bash
How to Install Software: Home Brew
I consulted the Koodiklinikka slack regarding how to install software to a Mac machine. The answer was to use Home Brew. It was easy to install as a package, and then add this line to .bash_profile
:
eval "$(/opt/homebrew/bin/brew shellenv)"
Command Line Tools, and Some Other Tools
Now, that we have Home Brew installed and configured, we can use it to install typical developer, and other tools:
# Command line tools.
xcode-select --install
# Emacs.
brew install --cask emacs
# A better terminal.
brew install --cask iterm2
# Meld (used as a git diff tool).
brew install --cask meld
# Chrome browser.
brew install --cask google-chrome
# VSCode editor.
brew install --cask visual-studio-code
Keyboard Mappings
I have configured all my Linux machines to use the same key bindings (for more information, read: Linux Keyboard Configuration with Keyd and Dygma Raise Keyboard Reflections Part 1 ). With these key bindings I type really fast, and without them I’m lost. Therefore I consulted Koodiklinikka slack once more: how to configure key bindings in a Mac machine. The answer was: Use Karabiner.
Using Karabiner, it was relatively easy to configure e.g. the navigation keys the way I like them. Example: CapsLock + ijkl => arrow keys.
...
{
"conditions": [
{
"name": "caps_lock pressed",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
...
I also switched the Fn
key with the Control
key, since I have the Control
in the lower left corner in all of my Linux keyboards:
...
"simple_modifications": [
{
"from": { "apple_vendor_top_case_key_code": "keyboard_fn" },
"to": [{ "key_code": "left_control" }]
},
{
"from": { "key_code": "left_control" },
"to": [{ "apple_vendor_top_case_key_code": "keyboard_fn" }]
},
...
For some reason the Jump cursor to the line beginning / line end
Karabiner configuration:
...
{
"conditions": [
{
"name": "caps_lock pressed",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "h",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "left_arrow",
"modifiers": "command"
}
],
"type": "basic"
},
...
… did not work with iTerm2 console. Therefore I added a special key binding for iTerm2 as instructed in StackExchange: added the hexcodes 0x01
for the beginning of the line
and 0x05
for the end of line
.
Backup the Configurations into a Git Repository
Finally, I created a git repo: mac-configs
, and stored all these configurations there, if I ever need to configure a Mac machine again. This way, next time, I can just clone that repo to a new Mac machine, and copy-paste the configurations from the repo to the right places. There is also a text file that documents these configurations, of course.
The Mac Look and Feel
I must say, Mac is really slick. The GUI is really impressive. And Mac is full of little niceties. E.g. when you download something, the GUI gives you a bouncing Finder icon telling you that the file you just downloaded, is ready in your Downloads
folder.
Another observation is, that most of the configurations were pretty easy to do. But. The configurations are a lot more GUI oriented. Using Linux, I like that most configurations can be done by just editing configuration files using Emacs. Maybe I’m just old-school.
And there is no X11 / Wayland and Linux with Nvidia driver hassle when using Mac. That is a big upside using Mac. I just spent one weekend fixing my Linux Wayland configuration with Nvidia driver 560 when sudo apt upgrade
had broken my Linux GUI (completely). I was very close writing a blog post regarding that experience: “The Unbelievable Pain of Using Nvidia with Linux.” With Mac, the GUI just works.
Conclusions
I would never start using a Windows machine as my primary developer machine. I have spent years in a corporation that forced all developers to use Windows machines. The first thing I always did with a Windows machine was to install Emacs and basic Unix tools for Windows. But that is not the same thing. Not at all. Nowadays you have the Windows Subsystem for Linux, which could make things a bit easier.
But, I could start using Mac. Mac seems pretty deasent as a developer machine. However, after using Linux some 10 years as my primary developer machine, I have configured my Linux machine so, that everything works exactly the way I like, and there is no reason to use some other OS - Linux is just the best OS for a software developer.