Installing the Programmer Dvorak Keyboard Layout on Mac OS X

These instructions are for a U.S. English version of Mac OS X 10.11.0 (El Capitan). Instructions for other languages and versions of the operating systems may vary.

Adding Programmer Dvorak to the list of available layouts

These steps must be performed from a user account with administrator access. By default, the main user of the computer has this capability.

  1. Open Safari and download the layout driver package. Safari will put this file into the ~/Downloads folder, unpack it and then start the installer.

  2. If you are on Mavericks or later, you must hold down the Control key while you click the package icon, and then confirm to Gatekeeper that you want to open the package.
  3. Choose Continue to skip the introduction screen of the package installer.

  4. Make sure that your main harddisk is selected as the target of the installation, and then click the Continue button.

  5. Click on the Install button to start installation.

  6. Enter your password to make a system modification, and then click on the OK button.

  7. Click on the Close button to acknowledge a successful installation.

Alternatively you can do an automated, non-interactive installation of the layout using this command:

sudo installer -pkg "~/Downloads/Programmer Dvorak v1.2.pkg" -target /

In Mavericks or later, you must now clear the layout cache before new layouts are recognized:

sudo rm -f /System/Library/Caches/com.apple.IntlDataCache.le*

Setting up your account to use the Programmer Dvorak layout

Mavericks or later

  1. Click on the Apple menu in the upper, left corner of the screen.

  2. Choose System Preferences... from the menu that appears.

  3. Click on the Keyboard icon in the second row in the window that opens.

  4. Select the Input Sources header.

  5. Click the + button in the lower, left corner.

  6. Select the English language at the top of the list on the left side.

  7. Select the Programmer Dvorak layout at the top of the list on the right side.

  8. Click the Add button in the lower, right corner.

  9. Tick the Show Input menu in menubar checkbox at the bottom of the window.

  10. Close the Keyboard window.

  11. Click on the Input Menu icon (the little keyboard or flag) in the upper-right corner of the screen.

  12. Select Programmer Dvorak from the list that is displayed.

Mountain Lion and earlier

These steps are taken from the article About keyboard layouts.

  1. Click on the Apple menu in the upper, left corner of the screen.

  2. Choose System Preferences... from the menu that appears.

  3. Click on the Languages & Text icon in the window that opens.

  4. Select the Input Sources header.

  5. Tick the Programmer Dvorak checkbox in the list (you must scroll down to see it).

  6. Tick the Show Input menu in menubar checkbox at the bottom of the window.

  7. Close the Languages & Text window.

  8. Click on the Input Menu icon (the little keyboard or flag) in the upper-right corner of the screen.

  9. Select Programmer Dvorak from the list that is displayed.

Login Window

To make the keyboard setting for the current user apply to the login window as well, run the following command in a Terminal window:

sudo cp ~/Library/Preferences/com.apple.HIToolbox.plist /Library/Preferences/

Also see the article Mac OS X: How to change the keyboard layout at the login window.

Using Programmer Dvorak as the sole layout

The user interface won't let you remove the old layout (such as US English). You can however use the PlistBuddy utility to remove the layout manually from the configuration files and replace it with another:

for file in ~/Library/Preferences/com.apple.HIToolbox.plist; do
    for key in AppleCurrentKeyboardLayoutInputSourceID; do
        /usr/libexec/PlistBuddy -c "delete :${key}" ${file}
        /usr/libexec/PlistBuddy -c "add :${key} string 'com.apple.keylayout.Programmer Dvorak'" ${file}
    done
    for key in AppleDefaultAsciiInputSource AppleCurrentAsciiInputSource AppleCurrentInputSource AppleEnabledInputSources AppleInputSourceHistory AppleSelectedInputSources; do
        /usr/libexec/PlistBuddy -c "delete :${key}" ${file}
        /usr/libexec/PlistBuddy -c "add :${key} array" ${file}
        /usr/libexec/PlistBuddy -c "add :${key}:0 dict" ${file}
        /usr/libexec/PlistBuddy -c "add :${key}:0:InputSourceKind string 'Keyboard Layout'" ${file}
        /usr/libexec/PlistBuddy -c "add ':${key}:0:KeyboardLayout ID' integer 6454" ${file}
        /usr/libexec/PlistBuddy -c "add ':${key}:0:KeyboardLayout Name' string 'Programmer Dvorak'" ${file}
    done
done

Notice that these commands will remove all layouts! Run PlistBuddy with the command -c "print" and then the filename, to see which settings that are current.

Keyboard type

The Programmer Dvorak layout enables the use of the Compose key on computers with an ISO keyboard (also known as International or European keyboard) attached. If your keyboard is detected as an ANSI (also known as Domestic or U.S. keyboard), it will not be available as ANSI keyboards have only 10 keys between the Shift keys whereas ISO keyboards have 11.

A simple way of checking for this is to install the Programmer Dvorak layout and then type the dollar ($) key, located at the upper left corner, above the Tab key. If you do not get a dollar sign, then you must change the keyboard type:

  1. Click on the Apple menu in the upper, left corner of the screen.

  2. Choose System Preferences... from the menu that appears.

  3. Click on the Keyboard icon in the window that opens.

  4. Select the Keyboard header.

  5. Click on the Change Keyboard Type... button.

    If this button does not appear, you should delete the file /Library/Preferences/com.apple.keyboardtype.plist. Next, if you have a USB keyboard, you should unplug/replug it, otherwise you must restart your computer. Then, start the procedure over again.

    Keyboards manufactured by Apple may have their type automatically detected so the button never appears. In that case, try to start the assistant manually by pasting this command into a Terminal window:

    sudo open /System/Library/CoreServices/KeyboardSetupAssistant.app/Contents/MacOS/KeyboardSetupAssistant
    

  6. Click on the Continue button.

  7. Press the key on the right of the left Shift key.

  8. Select "ISO (European)" from the list.

  9. Click the Done button.

If setting the keyboard type still results in the wrong layout, you may have an unknown keyboard. Please run the command listed below in a Terminal window and mail the resulting print-out to me.

defaults read /Library/Preferences/com.apple.keyboardtype "keyboardtype"

If you have MacOS X 10.6 Snow Leopard or earlier, you can also try the following commands:

python -c 'from Carbon import Evt; print "ADB Manager Device ID = ", Evt.LMGetKbdType ()'
python -c 'import gestalt; print "Gestalt Keyboard Type = ", gestalt.gestalt ("kbd ")'
osascript -e 'tell application "Finder" to get computer "kbd "'

Remove the Programmer Dvorak layout from your system altogether

You should first use the activation instruction to uncheck the layout so that it is removed from the Input Menu. If you also set it in the login window, you should copy the new settings after now selecting another layout.

When deactivated, a keyboard layout claims very little resources. If you however want to remove all traces of it from your system, start the Terminal utility application and then paste the following commands into the window:

sudo pkgutil --forget com.apple.keyboardlayout.Programmer\ Dvorak
sudo rm -rf /Library/Keyboard\ Layouts/Programmer\ Dvorak.bundle/
sudo rm -f /Library/Caches/com.apple.IntlDataCache*
sudo rm -f /System/Library/Caches/com.apple.IntlDataCache.le*
rm -f /private/var/folders/*/*/-Caches-/com.apple.IntlDataCache.le*

You will be asked for your password to continue. After performing these tasks, you should restart your system to regenerate the cache files.