Change keyboard layout to DVORAK from command line on Mac

This snippet did the trick for me. Note that I use Quicksilver to launch apps, so I remapped the keyboard shortcut for "switch input menu" from Cmd+Space to Option+Cmd+S.

osascript -e 'tell application "System Events"' \
          -e 'keystroke "s" using {command down, option down}' \
          -e 'end tell'