Making Mac OS X
less retarded more usable
As every programmer should know, having total control over one’s workstation is important. If you run any flavour of GNU/Linux you might already be quite versed into all sorts of obscure customizations, from using a very specific keyboard mapping to working with a custom compiled window manager. In the real world however, it’s not always possible to use that kind of stuff. For technological or pragmatic reasons, you might be stuck in an hostile environment against your will. This post is about how I dealt with that particular situation, stranded in the walled garden of Apple.
I spent the last two years working part time for Studio V2. Being an organisation founded by graphics designer, it seemed logical that the company culture revolved around the extensive use of Apple products. As such, my workstation was an iMac. This was a first for me and it led to some frustration, especially during the first few months. However, after some time I managed to make the best of the situation and made that machine truly mine, for the sake of my productivity and sanity.
Apple is well known for manufacturing their own keyboards using their very own layouts. Being French and a GNU/Linux user, I tend to consider the
oss_latin9 keyboard layout to be the best possible layout to write in French and English. It’s the layout I learned to “touch type” on and it makes it easy for me to access rare characters like œ, € and ©.
Since the release of Mavericks, Mac OS X includes some more traditional key mappings. You can enable them in the Preferences Settings and by selecting the Keyboard entry. From there you can select the “French - PC” layout. It’s not perfect, but pretty close to the
This won’t change the location of the command, control and option keys. It should be noted that if you select multiple layouts you can display an icon representing the layout urrently in use at the top of your screen, near the date. If you activate multiple layouts, you can quickly switch between layout by pressing command + space.
I managed to get used to most of it but ended up having difficulties dealing with the location of the right command and option keys. To change that I installed Karabiner, an application that can be used to create discrete mappings quite efficiently.
A proper terminal emulator can really change the way you work with the command line for the better. I replaced the mediocre Terminal.app with iTerm2, a fast customizable and lightweight terminal emulator. There are many other terminal emulators for OS X but this one worked best for me.
One of the main aspects of GNU/Linux I missed on Mac OS X was a reliable package manager. I knew of several projects that aimed at creating a piece of software that replicates the feel of having a Linux style package manager and I decided to go with MacPorts. The software library made available by MacPorts, sometimes simply referred to as “ports”, is quite impressive, but it should be noted that updating the stuff you installed can sometimes be quite slow. With that in mind, I tried to avoid having too much “ports” installed and picked third party installers when it was possible.
Homebrew is another package management solution for Mac OS X that was on my radar. I didn’t give it a whirl so I can’t comment on it. Maybe next time I’m confronted to a Mac OS environment I’ll evaluate it.
Customizing the shell
Tinkering with your shell shouldn’t be much harder than it usually is on any Linux distribution. Since I tend to use the command line for a lot of mundane operations, I fell in love with zsh. The way it handles command completion is just magical. You can install it with MacPorts with the following command:
% port install zsh
Once this is done you can change your default shell to zsh with the following command:
$ chsh -s /opt/local/bin/zsh
git, ssh and other cli stuff
Apple is kind enough to provide a sufficiently up-to-date version of ssh with the standard Mac OS X distribution, however, it would be wise to keep it updated. MacPorts provides a more recent version, but as mentioned earlier, I prefer to keep the number of ports I rely on to a minimum.
git along with several essential cli programming tools can be found in the XCode command line utilities. Once you’re done installing XCode on your machine, you can fire up a terminal, and run the following command to start the installation process:
$ xcode-select --install
This should open a window asking you if you want to install the command line developer tools. Once this is done you’ll have a C and C++ compiler, git, make and a load of useful stuff.
Restart your terminal emulator and you should be good to go.
pandoc is another tool I use a lot. It’s basically a universal document converter that specialises in dealing with Markdown. I often use it to convert quick notes I take in text files to printable LaTeX documents. MacPorts has a version that can be installed with the following command:
% port install pandoc
I also used MacPorts to install htop, it’s handy to have something to monitor certain processes. It can be installed with the following command:
% port install htop
tree is pretty handy tool if you do a lot of file and folder navigation in the command line like I do. You can install it with MacPorts like this:
% port install tree
Mac OS X is shipped with a basic version of vim, however, if you want to make full use of the clipboard integration with other GUI application on the OS, the MacVim “app” can be used.
MacVim provides a GUI version of vim in full cocoa flavour and includes a command line version version compiled with all the proper features you might want to make use of to bridge the gap between your cli vim instance and other GUI programs running on your system. That way you can have full copy and paste support, and once you’ve dealt with the mighty mouse, you can even use your middle click the way you may be doing it on your Linux machine.
I decided to go with that version instead of playing catch up with the one provided by MacPorts. To use it I created an alias in my .zshrc file that points to the vim executable located inside the MacVim “app” bundle. This would look something like this:
Dealing with the “Mighty Mouse”
Along with the keyboard, the so-called “Mighty” mouse was one of my biggest gripes with my iMac workstation. In my opinion, one of the vital things missing from this mouse is a third mouse button, or “middle click”. This is something I use constantly while browsing or editing text, more than ctrl + c, ctrl + v or shift + insert.
I thought about replacing this “Mighty” mouse with a regular mouse, however, I quickly realized that my heavy reliance on virtual desktops and the way Mac OS X handled them meant that switching workspaces would become a bit more difficult with a regular mouse. In retrospect, I should have worked harder to find a way to switch workspaces with my keyboard, the way I do it on my Linux box, but at the time I decided to keep the “Mighty” mouse and found another way to get my precious “middle click” back.
I used MagicPrefs to configure the “Mighty Mouse” so that it triggers a third button click when clicking with 3 fingers. In addition to mapping new buttons, this application can be used to modify gestures and the triggered events. It’s pretty neat if you want make this mouse a bit more “Mighty”.
As anyone who has ever used a mac can attest, window management is a pain. To be fair, window management is an issued only ever faced by power user, but it’s sometimes addressed gracefully by dedicated pieces of software on GNU/Linux environments. These applications are called Window Manager (or WM for short). For most of my time at Studio V2, it seemed to me that sane window management was just a lost cause on Mac OS X.
However, a few weeks before leaving the company, I was introduced to Spectacle, an Open Source WM for Mac OS X. With this you can move, resize and control your windows with key combination. I didn’t spend a lot of time tweaking it but most of the commands can be remapped. I’m sure that with a bit more time I would have been able to come up with something close to the way my WM works on Linux.
And the rest…
No need to present Firefox, you know it, I know it, it works on Mac OS X, that’s all there is to say.
In an effort to coordinate and sanitize my mail habits I decided to replace Gmail by Thuderbird. It’s the same on every platform (Windows, Mac OS X and of course Linux).
Do yourself a favor and drop Adobe Reader. It’s big, it’s slow, it eats your ram like there’s no tomorow. A great alternative is Skim, a lightweight PDF reader. It’s a Mac OS X exclusive but it’s fast and full featured. It’s a pleasure to use.
HexFiend is a simple hex editor. It’s small, has an API you can explore and does the job. It’s good and you might need it.
My quest for a proper IRC client ended with HexChat. It’s cross-platform, it’s fast and it’s customizable. I recommend it.
So here we are. I don’t know if I’ll be confronted to a Mac workstation ever again, but next time it happens, I’ll be prepared.