Linux user's guide to OS X

I've been running some sort of a Linux distro as my main OS for over a decade. However that has changed over past 6 months as I've switched to OS X and, while initially I've struggled, I now quite enjoy using it and will probably stick with it for a while. One of the main things that attracted me to OS X is a great hardware that other manufacturers still struggle to match. I've attempted to run Linux on a MacBook Pro before but that turned out to be impractical. Few years later I've decided to bite the bullet and start using OS X, here's my opinionated guide to replace/disable/change features of OS X that I've found annoying and install/enable ones that are more familiar to me as a long-time Linux user.

First things first: packaging system

OS X comes with no packaging system of it's own, albeit for the App Store, which doesn't count in my opinion. There are however at least two well-known solutions for that: MacPorts and Homebrew, if you ask me I would go with the latter. There's an easy one-liner to install it and afterwards you can use it from command line similarly to how you would use apt-get/pacman/emerge etc. Here's piece of documentation that I used as a crash course on brew.

Touchpad and middle click

Arguably Apple makes the shittiest mouses and the best touchpads. In fact, touchpads they make are so good that they've made a standalone version and I would choose that over the "magic" mouse every time. However the default config for a touchpad on MPB is crap. Half of the gestures are pointless and how on earth do I make a middle click with this?!

As far as gestures go I want taping for clicking, some form of a gesture for the exposé (or mission control which seems to be almost the same thing) and a gesture to switch virtual desktop. These are all configurable via preferences -> trackpad. While you there you can also invert the scrolling there from Apple to human on the middle tab and disable few useless gestures (e.g. lookup, launchpad) on other tabs. Now for the reasons beyond my understanding there is no support for three-fingers tap for middle click:

Screenshot showing preferences->trackpad on OS X
Screenshot showing preferences->trackpad on OS X

I mean WTF, how are OS X users supposed to open links in a new tab or close the existing tabs? And why Apple opted to have absolutely no support for such a basic feature? Luckily one brave Clément Beffa delivers where Apple fails, here is a little, open source app that enables middle click tap on OS X. Install it either with brew or directly and place it in login autostart configurable from preferences -> users & groups -> Login items [tab].

Decent luncher (Alfred)

I run everything with a luncher by typing first few letters of what I want - I find this much faster and less distracting than fiddling with taskbars/quicklunchers/desktop icons or dreadful start menus. OS X comes with it's own luncher called Spotlight and accessed with + space key combination. Spotlight is not too bad but there's a better alternative: Alfred capable of extra features such as file & web search, built-in calculator etc. I'm using it instead of Spotlight, you need to tweak the keyboard shortcuts for that.

Disable the Dock

The dock is basically a hybrid between a quick luncher and a taskbar, two things I dislike. It takes up space and annoy me with the distracting, jumping icons, worst of all it's a permanently visible gizmo that I never use. Unfortunately there's no way to disable the dock entirely, what we can do is make it autohide... and not come back for a very long time! Make sure dock is set to autohide in Preferences -> Dock, then fire up terminal and run:

defaults write com.apple.dock autohide-time-modifier -int 1000
killall Dock

Bye dock, was nice seeing you... not!

Remove Dashboard

Another useless feature of OS X is the dashboard, widget-ridden, left-most workspace that looks bit like old KDE's Karamba on steroids. Disable it with the following command:

defaults write com.apple.dashboard mcx-disabled -boolean YES

Keyboard for window management

One of the major pains I had with OS X was the lack of keyboard-driven window management facility. I like to organize my windows on the screen (and across screens) without reaching out to my mouse/touchpad. It's built-in on Windows, e.g. win + , it's highly customisable on Linux and it's totally missing from OS X. Luckily there's Slate. You can install it using brew or get it directly from Github. This little app is highly customisable and can shift, move, push and resize your windows based on keyboard inputs, window properties etc. You can configure it using it's own directive-based language or using a JavaScript API. Here's my simple config using the latter.

Replace terminal with iTerm

iTerm 2 is a highly customisable terminal replacement for OS X and it comes with some pretty awesome features. Any Linux user will feel at home, while you at it, why not add few extra features to the shell itself?

Keyboard settings & shortcuts

There are three things to do here, all within Preferences -> Keyboard. Firstly I switch the default behaviour of the fn so that F1, F2 etc. behave as standard function key - you can still use special keys such as volume up/down using a fn modifier key. Secondly disable some annoying keyboard shortcuts that may conflict with shortcuts you use elsewhere, e.g. Control + Shift + is used in Sublime Text for multi-line selection, however because it's also specified as a global shortcut (under mission control), Sublime Text will never receive that key combination. Finally on Shortucts tab, enable Full Keyboard Access by selecting All controls - enabling this allows for tabbing in dialogs and selecting answer using space.

One more thing that you might find annoying is using in common key combinations like copy/pasting, instead of the Control key used commonly in Linux and Windows. This however has multiple advantages and totally makes sense in the long run. Firstly more central key placement on the keyboard means you can press it in conjunction with more letter keys on the keyboard. Secondly your shortcuts don't conflict with your terminal signals (e.g. you can use + C in terminal for coping text and still use Control + C for sending SIGINT).

One more thing keyboard-related, most of your common Control-based shortcuts will work with instead. Here's a list of some other shortcuts that you mind find useful when migrating from Linux (or Windows) to OS X:

  • + W close (current) tab
  • + Q close current app
  • + Tab switch between apps, like (Shift to go backwards)
  • + ~ switch between windows of current app (Shift to go backwards)
  • + Alt + Esc force quit current app
  • + Shift + 4 Take a screenshot of a selected region and save it to the desktop. Alternatively instead of selecting a region, press Space and then application window to take a screenshot of that app.

And few specific to the dreadful Finder:

  • Enter to rename file/folder. Weird.
  • Space to get a quick preview of a file. Gives folder summary including size on folders.
  • + Open file or folder
  • + Go up one folder
  • + ] Go to "next" folder (like pressing the next arrow in the GUI)
  • + [ Go to "previous" folder (like pressing the back arrow in the GUI)

BTW: there's no + X in Finder... go figure.

Hide desktop icons

I never liked the concept of desktop, it gets very untidy very quickly, especially with all these screenshots being automatically saved to desktop. Switch off desktop icons, you can still access files on desktop from within Finder and/or terminal:

defaults write com.apple.finder CreateDesktop false

Show hidden files in Finder

Your home is full of config files which names start with a dot and Apple think it's harmful for you to see them, here's a little trick to force finder to display them:

defaults write com.apple.finder AppleShowAllFiles YES

Also explains helps you see how your OS is spreading these annoying .DS_Store just about everywhere.

Missing any Linux apps?

One advantage of OS X on Linux is that it's not second-class citizen when it comes to commercial software. You can get Photoshop, Unity, Unreal Engine, you can get many more games etc. where with Linux you're confined to WINE and open-source alternatives. However some open-source alternatives are actually pretty awesome and you might want to use them in OS X - well it might be possible. Most command-based open-source software works just fine on OS X and window-based software, if haven't been fully ported, can be run with OS X specific X server implementation - Xquartz. That being said there are some disadvantages that you need to consider:

  • You need to untick "Displays have separate Spaces" in Preferences -> Mission Control, which is bit annoying, but without it Xquartz windows tend to get lost
  • Apps running in Xquartz will not recognize keyboard shortcuts with key, use Control instead.
  • Some apps tend to misbehave slightly, e.g. Inkscape will occasionally just not start.

Couple of quick fixes for the shell

If you're used to running ifconfig just to get the ip address, it's a little messy in OS X, because of all the fake/virtual interfaces. My solution for this is the following alias (en0 is my wireless interface):

alias ip="ipconfig getifaddr en0"

The netstat command behaves slightly different on OS X than on Linux and seems to be much less useful, here's a nice function to check which process is listening on given port, just stick it into it your .zshrc/.bashrc file:

function whatsonport () { echo "$(lsof -n -i4TCP:$1)"}

Few closing notes

With all the customisations and extra layers of software installed you need to be very careful with updates. Make sure that productivity software you've installed (Slate, Alfred, middleclick, XQuartz) is actually going to work after you update to the next major version (major in this context being 10.9 to 10.10).

I hope you found my subjective guide or at least some parts of it useful. I invite you to share your own migration tips in the comments section below.