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
emacsclient, you need to add that path to the default
PATH environment variable for OS X apps with
Warning: Homebrew’s instructions.
this Apple doc,
which doesn’t work in Mountain Lion!
Here are some packages I’ve installed so far:
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
cd /usr/local, run
brew versions PACKAGE, run its
command for the version you want, then just run
brew install PACKAGE
[OPTIONS] and optionally
brew [un]link PACKAGE.
Apache is installed but not started by default; run
apachectl -k start to
start it. Here’s
more on setting up LAMP.
One word of warning: don’t start/stop/restart MySQL with
/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
It’s also the part that I haven’t been able to match, at least so far. I’ve found programs with similar ideas, but most of them seem like glorified bags of shortcut keys for pushing windows around. I haven’t found many that actually manage my windows for me. I’m not the only one, either.
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:
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
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
Support/Firefox/Profiles/personal and updated the fully qualified home
directory paths in
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
Also, another not-Mac-related note: I love
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.
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
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
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.
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
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
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
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,
Keychain integrates with SSH keys automatically, which is pretty damn cool.
Sadly it doesn’t also handle GnuPG keys, but I only use mine rarely, so I don’t
mind typing the password each time or just using stock
set your hostname
in the GUI, go to System Preferences, Sharing, Computer Name. To do it from the
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.
- 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
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.
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 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.
One KeyRemap4MacBook 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.
Finally, 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.
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.
also looks handy. It can search an index of all installed docsets, and there’s
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 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.
pingcommand 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
/sbinwas no longer in my path by default. Anyway.
- My laptop’s hostname kept getting renamed with a numeric suffix, e.g.
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.
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
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!