Map Caps Lock to change keyboard layout in Mac OS X

Solution 1:

Expanding answer of @mrded for macOS Sierra.

I used Karabiner-Elements to remap caps_lock to f19. To this end I placed the following file karabiner.json to ~/.karabiner.d/configuration:

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "simple_modifications": {
                "caps_lock": "f19"
            }
        }
    ]
}

Then I opened Keyboard preferences → Shortcuts → Input sources and selected F19 as "Select the previous input source" option.

Note also that according to Lifehacker, there is built-in feature in macOS Sierra to switch layouts with Caps Lock but it seem to work only with some layouts. (At least I don't see this feature for my layouts which are Ilya Birman's typographic Latin/Cyrillic.)

Solution 2:

It depends on the version of Mac OS X you are running (on 10.13.5 it's definitely possible). System settings -> Keyboard -> Input sources -> checkbox about Caps Lock