Mac OS X

My current Mac setup instructions are here instead.

After 12 years on Linux, I’m grudgingly switching to Mac OS X. I wasn’t excited about it, but it’s better than I expected. It’s not news any more, but yes, OS X is a usable, pretty skin on top of a real POSIX OS. Darwin is definitely different from Linux, but it’s close enough to feel familiar, and smooths over pretty much all the rough edges you might hit on a Linux distro.

Even so, it’s a big change from what I’m used to. Here are some of the things I’ve done to make it feel comfortable.


One of the first things I missed was APT, the package manager. Apple’s App Store is nice, but it’s aimed at end users, so it’s not so good for installing e.g. GNU utilities or MySQL. A while back I might have used MacPorts (nee Darwin) or Fink, but the new hotness now is Homebrew, which I’m liking a lot.

One note: homebrew formulae that include .app files usually put them in /usr/local/Cellar/[formula]/[version]. You can symlink them directly into Applications from there to install them.

Another note: for .apps to use binaries installed by homebrew in /usr/local/bin, e.g. emacsclient, you need to add that path to the default PATH environment variable for OS X apps with launchctl setenv. Warning: Homebrew’s instructions. point to this Apple doc, which doesn’t work in Mountain Lion!

Here are some packages I’ve installed so far:

  • autoconf
  • automake
  • colordiff
  • coreutils
  • emacs
  • exif
  • ffmpeg
  • flickcurl
  • fontconfig
  • freetype
  • fuse4x
  • gettext
  • glib
  • gnupg
  • go
  • graphicsmagick
  • hub
  • imagemagick
  • jpeg
  • libexif
  • libpng
  • libtool
  • libyaml
  • mercurial
  • mpg123
  • mplayer
  • mysql
  • pkg-config
  • pstree
  • rename
  • sshfs
  • wget

Homebrew is great at upgrading, and you can use brew switch to downgrade to an older version, but only if you already have it installed. If you don’t, there’s no an easy way to install it. On the rare occasion that I’ve needed to, I followed this recipe. Executive summary:

  1. brew unlink PACKAGE
  2. brew info --github PACKAGE
  3. Open the history page.
  4. Find the version you want.
  5. cd /usr/local
  6. If the formula is from a keg, cd Library/Taps/KEG.
  7. git checkout VERSION
  8. brew install PACKAGE [OPTIONS]
  9. git checkout master.

I also installed a few python libraries:

sudo pip install httplib2 py-dateutil

Apache is installed but not started by default; run apachectl -k start to start it. Here’s more on setting up LAMP. Do basic admin with sudo apachectl -k {start|stop|restart} and launchctl {unload|load} ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.

One word of warning: don’t start/stop/restart MySQL with sudo /Library/StartupItems/MySQLCOM/MySQLCOM start. That brings it down but refuses to bring it back up, at least on my machine. I have to reboot to get it running again. :(

Window management

One of the most important parts of my Linux setup was my tiling window manager, Ion, which I followed with a brief stint on notion (a fork) after Ion’s author went crazy.

It took me a while to find something comparable on Mac OS X. I settled on Slate, and I’m pretty happy with it. Here are my .slate and .slate.js. It’s disappointing that the project itself is abandoned, but meh. mattr’s fork used to be maintained, but not any more either as of 5/2017. I should eventually switch to Hammerspoon.

One minor config note: when I used multiple displays and focused a window of an app on one display that also had windows on the other display, it focused the window on the current display first. The fix was to turn off Mac OS X’s System Preferences -> Mission Control -> Displays have separate Spaces. Details in jigish/slate#377.

I found lots of other programs with similar ideas. xnomad and Tyler WM both looked pretty good, but the rest seemed like glorified bags of shortcut keys for pushing windows around. Moom, ShiftIt, Divvy, SizeUp, Spectacle, Optimal Layout, Doublepane, and Stay all look interesting, but none of them look like they actually manage my windows for me. I’m not the only one who wants this, either.


I pretty much live inside just two programs: Emacs and Firefox. I was able to migrate my configs for both, which made switching OSes a lot easier.

There are plenty of Emacs packages for OS X. I used Homebrew and ran brew install emacs --cocoa to get Emacs 24.2 with native full screen support backported from 24.3.

I hadn’t used Emacs 24 before this. One of my favorite new features is the built in package manager. Here are the extra packages I’ve installed so far:

  • apache-mode
  • apples-mode
  • async
  • dash-at-point
  • emacs-cl
  • git-link
  • helm
  • go-mode
  • json-mode
  • less-css-mode
  • lua-mode
  • markdown-mode
  • php-mode
  • rainbow-delimiters
  • rainbow-identifiers
  • redo+
  • smartscan
  • yaml-mode
  • youtube-dl

Emacs’s GDB integration is great, but it takes a few extra steps to get it working on Mac OS X.

Darwin’s GDB 6.3 seems to work, but doesn’t really. Programs running under it crash randomly where they wouldn’t otherwise. :/ First, get GDB 7.5 via homebrew instead by running brew install gdb. Then, sign gdb to tell the kernel it’s allowed to attach to other processes. Follow these instructions, then run codesign -s gdb-cert /usr/local/Cellar/gdb/7.5.1/bin/gdb (assuming you named your certificate gdb-cert.)

Now run M-x gdb in Emacs and enter /usr/local/bin/gdb -i-mi [BINARY], or M-x gud-gdb and /usr/local/bin/gdb --fullname [BINARY] if you want the old version of GUD, and you’re off!

Sometimes Emacs gets unhappy and complains Wrong type argument: frame-live-p, #<dead frame … whenever I try to kill a buffer. This fixes it: M-: (setq menu-updating-frame nil).


I migrated my Firefox profile by brute force: I copied my profile directory directly from ~/.mozilla/firefox/personal/ to ~/Library/Application Support/Firefox/Profiles/personal and updated the fully qualified home directory paths in prefs.js, search.json, extensions.ini.

This mostly worked, but a few things like history didn’t entirely make it. Next time, I might consider a backup and restore utility like FEBE instead.

I also noticed that fonts were grainy on Firefox 19 on my retina display. Evidently this is temporary until Firefox 20, to work around a bug. I followed these instructions to re-enable retina display support by setting gfx.hidpi.enabled to 2 in about:config.

One note: my tweak to stop app tabs from glowing when they have updates didn’t work out of the box. It took a while, but someone on the Apple StackExchange finally led me to the fix. Yay!

Also, another not-Mac-related note: I love Greasemonkey, and I also love the Twitter Keyboard Shortcuts userscript. It makes o open the first link in a tweet, p go to the author’s profile, and more. So useful.

At one point, Firefox started hanging on me regularly. As often as once or twice a minute or so, it would hang for ~5s or so, sometimes long enough to make OS X show me the beach ball. I looked through Mozilla’s Firefox troubleshooting docs and found a recommendation to remove old session restore files, sessionstore*.* and sessionstore-backups/* in my Firefox profile directory. That helped, but only for a couple weeks. I then tried the bigger hammer of wiping my places database (sniff), and voila, that did the trick!

I set media.autoplay.enabled in about:config to false to stop videos from playing automatically.

WebExtensions and multiprocess

Mozilla made big changes to Firefox leading up to version 57 aka Quantum (more), notably multi-process support (aka Electrolysis) and supporting only WebExtension (more). Many of the plugins I use are old and based on XUL or not multi-process compatible, so they stopped working when Quantum shipped in November 2017.

Mozilla put together some resources to help find WebExtension alternatives to existing plugins that don’t migrate. Here are some of mine:

Keyboard shortcuts were by far the hardest to migrate. The WebExtension commands API is famously weaker than the old XUL-based API. Most plugins gave up migrating entirely.

Fortunately, I only really care about a few custom key bindings. In particular, I have decades of switching between windows with ⌘ (Command) I/J/K/L burned into my muscle memory, so ⌘-L to focus the address bar is a non-starter. I use Control-L instead. I ended up using Karabiner Elements to map that to F6, its second key binding in Firefox. I similarly mapped ⌘-[0-9,Backspace] to Control for switching to specific tabs.

This list of built in keyboard shortcuts and this exhaustive background design doc were both useful references.

Mac OS X

There are lots of little differences in the OS and its shell. To start, I knew it would ask me to make an Apple Id for use with the App Store and other Apple services, but I didn’t expect it to be quite so aggressive. Even so, I’ve managed to sidestep it so far. I had to create one to download XCode, but I’ve avoided attaching it to the computer itself.

Programs are usually run as .app files, executable archives that include a manifest, binaries, supporting files, icons, etc. They’re usually placed in the /Applications directory. The actual binary(ies) are in XXX.app/Contents/MacOS/.

Outside of the App Store, there are two standard ways to install programs. .dmg files are disk images, not zip files or installer binaries. Double click on them to mount them, drag the application file inside to the Applications folder, then unmount the image and optionally delete it.

.pkg and .mpkg files are package and multipackage installer binaries, respectively. They’ll open with the built in installer program automatically, or you can run it manually: sudo installer -pkg /Volumes/someapp/someapp.mpkg -target /

Power management is pretty solid out of the box, and there’s even a useful command line utility, pmset. There’s no built in way to tell it not to sleep when the lid closes, but there are third party programs like InsomniaT and NoSleep. Power nap looks related but isn’t; it’s proprietary and only wakes up to do Apple-specific things. Incidentally, the keyboard shortcut for sleep is Cmd-Option-Power.

System Preferences is self explanatory; it’s the equivalent of dotfiles in *nix and Control Panel in Windows. I think it’s actually just a pretty frontend to System Information (in Utilities), which is similar to GConf or the Windows Registry. The actual preference data is (sometimes?) stored in .plist files. There used to be a standalone Property List Editor app, but now it’s embedded in XCode. There’s also the defaults(1) command line program.

There’s a cottage industry of system tweaking programs like Onyx and Cocktail, similar to Windows’s venerable Power Toys, that just set preferences that aren’t exposed in the System Preferences UI. There are also plenty of good lists of individual useful settings to change.

I turned on FileVault 2, Apple’s full-disk encryption system, which is evidently much better than version 1. The only disappointing thing is that it requires me to log in with my password after a certain amount of idle time. I tried to disable that, but I needed to turn on automatic login, which FileVault doesn’t allow. I even tried variations on defaults write com.apple.screensaver askForPassword 0, but no luck. Sigh, oh well.

Networking is pretty straightforward, and has its own command line utility, airport.

Keychain integrates with SSH keys automatically, which is pretty damn cool evidently no longer integrates with ssh-agent automatically, as of Sierra or High Sierra. It doesn’t handle GnuPG keys either, but I only use mine rarely, so I don’t mind typing the password each time or just using stock gpg-agent.

To set your hostname in the GUI, go to System Preferences, Sharing, Computer Name. To do it from the command line: scutil --set [HostName,LocalHostName,ComputerName]

Run this to always show the full path in Finder windows: defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES.

Sound has a nice feature: it automatically remembers volume for headphone vs speakers separately, which helps you avoid blowing out your eardrums. Nice.

Oddly though, the baseline volume is too loud for a few of my headphones. Other people have the same problem. This StackExchange question offers a number of solutions:

  • Hold Option and Shift while pressing the volume buttons to get smaller increments, or use the Menu Bar icon. Neither of those go as low as I’d like, though.
  • Use the Volume Down button to lower the volume all the way to zero, then press the Mute button to unmute. This goes much lower than even the smallest Option-Shift increment.
  • Use AppleScript: osascript -e "set Volume 0.01". I couldn’t get it to register anything below .01, though, which is the same volume as the unmute trick above.
  • Install a third party equalizer like Hear or limiter like Sound Bunny or Volimiter.

In the end, I went the low tech route and passed -volume 1 to mplayer, my music player of choice.

If you have multiple displays, the Menu Bar is always on the “primary” display. This is inconvenient when you’re working on another display. You can move it, but you need a third party app to duplicate it on all displays. Also see this discussion, among others.

Many *nix-isms work like you’d expect, but not all. .login files are one that didn’t make the cut. To resurrect yours, put it into a shell script, or just chmod +x it and add #!/bin/bash at the top, then add a Login Item for it to your user in System Preferences => Users & Groups.

cron is deprecated on Mac OS X in favor of Apple’s own launchd. I ported my crontab with this tutorial and Apple’s reference doc.

Keyboard and mouse

Thanks to Fitts’ law, I tend to use the keyboard much more than the mouse. Fortunately, OS X has lots of built in keyboard shortcuts, and it’s very configurable out of the box. You can also add shortcuts to third party applications, to a degree, and wonder of wonders, even swap Caps Lock and Control. (Speaking of which, if you do that in System Preferences, remember to do it in each keyboard you use!)

Beyond that, the best thing I’ve found to make OS X more keyboardable is Karabiner (née KeyRemap4MacBook). I use it to get Sticky Keys that don’t lock, add Emacs key bindings in text controls, reclaim some of the function keys, make Control-arrow keys navigate by words, make Return act like Control when it’s held down, and emulate my beloved missing Page Up and Page Down keys. (Function + arrow keys work, but take two hands, so they’re not quite the same.)

One Karabiner note: if you bind simultaneous key presses, e.g. pressing both down and right arrow keys together to Page Down, try lowering the [Simultaneous Key Presses] Delay Threshold setting in the Key Repeat tab as low as you can, ideally 10ms or so, so that pressing those keys in rapid succession doesn’t accidentally trigger the new binding.

It’s not all kittens and rainbows, though. I sorely miss Windows and Linux’s Shift-F10 shortcut for right click. Evidently there isn’t an equivalent one in OS X. You can use mouse keys and Ctrl-5, but that ties up the rest of keyboard, so it’s not really an option.

Likewise, there’s no built in shortcut for maximizing a window, but you can easily add one on an app by app basis in System Preferences, using the Zoom menu item.

I also dreadfully miss navigating menus with the keyboard. There’s a keyboard shortcut to focus the menu bar, but it doesn’t work in all apps, e.g. Emacs.

Some modal dialog boxes can’t be navigated with the Tab key, even with Full Keyboard Access set to All controls in System Preferences => Keyboard. I think the common thread is that those dialog boxes don’t have a corresponding GUI app running, e.g. Slate. I thought they were utility windows, but they don’t respond to Ctrl-F6 either.

In Adium (and maybe other apps?), two dashes -- get replaced by an emdash . To disable this, right click on the text box and uncheck Substitutions => Smart Dashes. (Details.)


I prefer to write code in Emacs and read docs in Firefox, but I’ve been working on iOS apps recently, which Apple only halfheartedly supports outside of its IDE, Xcode. Fortunately, other people have stepped in to fill the void.

Apple’s developer docs for Objective C, Cocoa, Mac OS X, iOS, etc. are stored on your hard drive as HTML – yay! – so they’re easy to read in a browser. Look in ~/Library/Developer/Shared/Documentation/DocSets and point your browser at Contents/Resources/Documents/index.html inside the docset you want to read.

docsetutil (/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil) also looks handy. It can search an index of all installed docsets, and there’s Emacs integration.

I’m currently trying out Dash, a document viewer that includes a ton of docsets for popular languages, platforms, and frameworks. It looks great so far, and has Emacs integration too.


Upgrading from High Sierra to Mojave 10.14 was pleasantly uneventful. It worked on the first try, all of my apps work fine, and I haven’t noticed a single problem yet. Fingers crossed it stays that way!

Sierra + High Sierra

I upgraded from El Capitan directly to High Sierra 10.13.1. It failed the first time with File system verify or repair failed, but then it retried and succeeded. ¯\_(ツ)_/¯

My key binding app, Karabiner, had to be rewritten from scratch as Karabiner Elements to support Sierra and High Sierra. I ported my config, and everything survived except unlocked Sticky Keys. Hope they get to that soon!

The rest of my apps all seem to still work fine, including more OS sensitive utilities like MenuMeters, Slate, Homebrew (including /usr/local), GNU Coreutils, and GNU Emacs.

Mac OS upgrades always wipe and install fresh copies of some system config files I’ve modified for a local MAMP setup, e.g. /etc/apache2/httpd.conf and /etc/php.ini.default, so I had to re-add my modifications. High Sierra also upgraded the system PHP from 5 to 7, so I updated httpd.conf to LoadModule php7_module libexec/apache2/libphp7.so.

After upgrading, applications lost access to my login keychain and could no longer read or write passwords stored there. They repeatedly asked for passwords that I could see in that keychain. When I opened one of the entries in Keychain Access and clicked Show password, it said Access to this item is restricted. The provided password did not unlock this keychain, or access has been limited to a particular user account. I managed to fix this by running First Aid on my hard drive in Disk Utility.

My mouse pointer also started disappearing regularly, sometimes as often as once every minute or two. Happened more often when I had a second monitor connected, but also sometimes without. Web searches found lots of tricks to bring it back that didn’t work for me – Cmd-Tab, Cmd-Option-Escape, change cursor size, drag, right click – and one that did, activating the screen saver and then deactivating it.

I didn’t find many ideas for how to prevent it in the first place, though. I finally turned some related Accessibility settings on and off again (zoom, cursor size, shake to locate etc.) and reset my NVRAM, and that seemed to do the trick. ¯\_(ツ)_/¯

El Capitan

Upgrading to El Capitan was mostly uneventful. Here are some minor notes:

  • API changes broke one of my favorite utilities, MenuMeters. The author thinks it’s unfixable, but Yuji Tachikawa has patched it so it works. Yay!
  • Emacs’s visible-bell feature is half broken too. They’re working on it.
  • The three finger drag option is no longer in System Preferences => Trackpad. It’s now in System Preferences => Accessibility => Mouse & Trackpad => Trackpad Options… => Enable dragging.


Upgrading to Yosemite was pleasantly uneventful. Here are some minor notes:

  • Evidently, if you have anything in /usr/local, your upgrade will slow down drastically. I moved it to my home directory before upgrading, then back afterward, which worked fine.
  • As of 10/25/2014, UI buttons and controls don’t highlight in blue when you focus them with Tab like they did in previous versions. This is probably a bug, and it’s been reported on OpenRadar.
  • The ping command was no longer in my $PATH. At first, I thought it had just disappeared, but I finally discovered it had moved to /sbin. Or maybe /sbin was no longer in my path by default. Anyway.
  • My laptop’s hostname kept getting renamed with a numeric suffix, e.g. hell-3 instead of hell, and the suffix kept increasing. This is evidently due to new discoveryd behavior. Run this to disable that behavior: sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments: string --no-namechange" /System/Library/LaunchDaemons/com.apple.discoveryd.plist (Also see this discussions.apple.com thread.)


I used Pidgin on Linux. Adium, its OS X counterpart, seems like an ok replacement so far. One obscure feature I liked in Pidgin was the ability to turn off the “Ryan has left the conversation” notifications that it sends when I close chat windows. Happily, it looks like Adium turned these off entirely a while back.

I’m using Menu Meters to get minimal CPU and network activity monitors in the menu bar.

I’m using HoRNDIS for tethering over USB to my Android. I wish it put an icon in the menu bar, but otherwise it’s great.

The built in Python doesn’t read my ~/.python. Not sure why yet.

I have an Android phone, which meant I needed to download Google’s Android File Transfer MTP program to transfer files to it over USB. It works, but has one annoying feature: it automatically starts whenever I plug my phone into my computer. I followed these instructions to disable that. Be sure to kill it in Activity Monitor before removing the login items and renaming the agent app!

Recently, I’ve seen a distnoted process occasionally spin up and chew up 100% CPU (on one core) and a ton of memory, often in the neighborhood of 1.5G or so. The command line is /usr/sbin/distnoted agent, and it’s started by launchd, neither of which help much. Web searches say distnoted manages notification delivery, and lots of other people report the same problem with it, but no single clear fix.

I asked about it on StackExchange, and after some debugging, we determined that it was being started by Spotlight, OS X’s filesystem search feature. I’ve reined in the paths and file types that Spotlight is allowed to index, but that hasn’t fixed it.

…it turns out this is probably an Emacs memory leak that’s fixed in 24.4. Fingers crossed!

I noticed that my network connections (maybe just WiFi) were disconnecting when the display turned off. I went to System Preferences, Energy Saver, Power Adapter, and checked Prevent computer from sleeping automatically when the display is off and unchecked Wake for Wi-Fi network access. I also ran sudo pmset -a sleep 0 to disable the computer sleep (as opposed to display sleep) timer. Fingers crossed!

Mac OS X has multiple temporary directories, which is confusing. /tmp is symlinked to /private/tmp, which is evidently the system’s temp dir. (?) There’s also a multi-level hierarchy under /var/folders, which contains per-user temp dirs. Mine is currently /var/folders/y_/7mgz0yqd.../T/. OS X also points my $TMPDIR there by default.

This got confusing after a while, so I eventually switched the /tmp symlink to point to my /var/folders/... dir and opened up its permissions to a+rwx so that daemons like Apache and MySQL could use it. Bad hygiene, but my laptop isn’t a real server, nor is it really multi-user, so whatever.

Remaining problems

In Yosemite, many apps lost the highlight around selected buttons, which makes tabbing between them difficult. StackOverflow say this is a Yosemite bug, and the fix is for each app to recompile with the current Xcode and libraries. Sigh.


21 thoughts on “Mac OS X

  1. I actually switched back a couple of years ago… Funny right? I still use a MacbookAir at work (although I do have it dual booting), but I’m 100% linux on my home office desktop. via Facebook

  2. Your use of computers sounds a lot like mine. I went through a similar process a few years ago, and subsequently switched back to Linux. I’m happier with the feeling of freedom and control that I have on Linux, but on the other hand I have spent quite a lot of time tinkering with my kernel config, packages, settings, etc. Of course I did the same when I switched to OS X, like you appear to have done. If I weren’t so obsessive about tinkering, I probably could have skipped most of that and been fine. Functionally, I find Linux and OS X pretty much equivalent for my uses. There are a few things better on one than on the other, most of which you mentioned. I’m happy on Linux now. I’m thinking of getting a Google Chromebook Pixel and installing Ubuntu on it.

  3. I tried, gave up and used Ubuntu instead on a think pad. The first you need to do on a Mac is to install "Unix" as it does not come with the stuff needed in as normal Unix. That's kind of bad sign. Cygwin under window is easier… via Google+

  4. Does it seem prettier to you?
    Give Alfred.app a try some time; it’s a good launcher + general GUI tool.

  5. I’m a layman, but I think Linux is simpler and more stable with parallel processes, and less proprietary so many people can add improvements. Does this shift mean that Apple’s OS is nonetheless better designed? via Facebook

  6. You should check out quicksilver if you haven't already. It's infinitely better than spotlight for launching apps and finding files (fuzzy search ftw) and you can also use it as a clipboard manager, control iTerm/terminal, et al. Fun application: http://qsapp.com/ via Google+

  7. I tried to use a MacBook Pro 5 years ago, for a week, couldn’t figure out a solution for PgUp/PgDown and Caps/Ctrl. That was my primary reason for giving up on the experiment, glad to see that’s easier to do now :-)

  8. Pingback: Ryan Barrett

  9. It’s interesting to see how during the late 90s Apple’s OS was less better looking than Windows. With the release of OS X, though, Apple really took the lead by managing to design a UI that was more beautiful than Microsoft’s. Nevertheless, while I realize haters gonna hate, I still use them both and believe they each have their purpose in today’s computing world. But deep down inside, I know I prefer macOS, and can’t wait for High Sierra.

Leave a Reply

Your email address will not be published. Required fields are marked *