Quick Python/Developer tips for OSX Lion

by jesse in ,

Lion king 5067

Yes; of course I upgraded to OSX Lion on day one. To quote myself from twitter:

I am happy in the warm coziness and stark whiteness of Steve Jobs' monoculture.

Regardless of that though, I had very few hiccups with Lion itself - but a few things you need to deal with going in:

  • Be on a high bandwidth connection. The downloads you have to make are huge.
  • XCode 4.x is now free in the App Store - you need this - the first thing you need to install after Lion is the latest version of XCode from the App Store, if you do this, all your virtualenvs, your homebrew environment (at least mine) just Keep Working. Save yourself some pain.
    • Side note: @kennethreitz, gentleman scholar, has actually done a custom osx-gcc-installer - this contains a system install of GCC and all the goodness you need (such as install_name_tool) for Python hacking. So you might be able to skip the massive XCode install.
    • When installing XCode, for some unknown unholy reason, if you have not quit itunes, and itunes helper (see activity monitor) prior to starting the XCode installer, the install will hang. Do yourself a favor and kill it with fire.
    • Remember; the binary directory for the dev tools is in /Developer/usr/bin/ - this includes gcc-4.2
    • Do yourself a favor, drop "export ARCHFLAGS="-arch x86_64"" into your .bash_profile.
  • If you're running homebrew; after the upgrade, I recommend a brew update && brew upgrade
  • If you use mercurial - you need to install the updated version found here.
  • Just for good measure, do a global (sudo) reinstall of virtualenv, virtualenvwrapper and pip. Make sure they're pointed at the right default Python (in my case the system one).
  • If you are using VMWare Fusion: You really need to be running the latest version of 3.x.
  • If you are using Bootcamp, and plan on turning on full disk encryption, see this note from Hacker News (this is why I confine windows to VMware images)

Other than the above; my dev environment pretty much just kept rocking - Lion's default Python install is a healthy Python 2.7.1 - double nice++ - MacVim, editor of choice just kept plugging away, although I have not tried the "official unreleased" version they have for Lion. I have a slight aversion to running beta builds of my editor.

Some of you are going to run into some annoyances; I can't help you with all of them, but I can help you with the two interface changes I could not deal with (I actually like all the other ones).

  • First; go into system preferences > mission control and uncheck "Automatically rearrange spaces based on most recent use" - trust me, you'll thank me.
  • Second, there's this ... annoying animation when you make new application windows (See the Ars Lion Review | kindle version). The animation offends me on a cellular level. You disable it by running this on the command line:
    defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO ; killall Dock
  • Show hidden files in finder:
    defaults write com.apple.finder AppleShowAllFiles -bool YES
  • Show full paths in finder:
    defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
  • Note: Don't like mucking around with the command line, or want to have something with a birds eye view that can control just about anything, check out "Secrets" from blacktree. I'm fine with magic PLIST hacks, but this does put a nice UI on all the hacks.
  • Also, if you're a power user, or want tiling behavior for windows - see SizeUp or Divvy (I use Sizeup) both of which are excellent additions to window management, even in Lion. I tend to be anal about window coordination on the screen even with mission control/expose.

Other than that; I'm a happy camper. The new scroll behavior on the trackpads is amazing, if not jarring when using a mouse. Everything just pretty much kept working for me. But then again, I'm pretty easy to please.

See also - "Four Lion Terminal Hacks" from Macworld and "Top 10 Secret Features in OSX Lion" from Lifehacker - if you really, really hate the UI changes, see "How to de-IOSify" from Lifehacker. More cool tips and tricks: "Miscellaneous Lion Tips and Tricks" and also "Miscellaneous Lion Tips and Tricks part two".

p.s. I originally forgot to mention this - but the full disk encryption in Lion is implemented damn well - it's easy for users to "get" - seamless, and transparent. In my honest opinion, this is worth the price of upgrading alone if you have a laptop. It's so well done, and it simply shows how crappy filevault was - it also goes to show that if you make crypto easy and transparent for users, they might actually use it. See the Ars Review for a deeper dive. See also "PGP WDE vs. Lion Disk Encryption"

p.p.s. See this ArsTechnica article about how to create a bootable copy of the Lion install disk you can use to do offline installs for other machines. I'd recommend doing the same for XCode if you have more than one mac to upgrade (or you lack FiOS).