Keyboard layouts can be installed in one of the following locations:
/Library/Keyboard Layouts/ ~/Library/Keyboard Layouts/ /Network/Library/Keyboard Layouts/
Resources in /Library/ are shared among all users on a given machine. Resources in ~/Library/ are visible only to that user. Resources in /Network/Library/ are shared among all users on a network.
In Finder, ~/Library may be invisible. From menu, Go > Go to Folder
and manually type
~/Library
After installing a new keyboard, reboot (if you installed the layout system-wide), or log out and log in again (if you installed it for the current user only).
If you have a Mac OS version earlier than 10.9.1 Mavericks
Open System Preferences > International. Click the Input Menu tab.
Scroll down until you find the name of the keyboard layout you just installed. Make sure the checkbox is selected. The layout is now ready to use.
If you have OS 10.9.1 Mavericks or later
Open System Preferences >Language and Region. Click the Keyboard Preferences button at the bottom.
Click the Input Sources tab at the top.
Click the + (plus) sign at the bottom left to ‘add a keyboard layout’.
Select Others in the left-side pane, this should display a list of keyboard layouts which includes the one you are looking to activate. Select the keyboard you want and click add. Don’t worry if the message says ‘Keyboard layout not available’, just ignore this.
The layout is now ready to use.
“Others” may be the last entry (out of the alphabetical order).
For more details, look at
http://www.languagegeek.com/keyboard_general/mac_installation1.html
WARNING: if you want to edit .klayout files manually, keep in mind that on needs to
disable Smart Quotes in TextEdit’s menu Edit > Substitutions (every time one opens such a file)!!!
(When bisecting, it is enough to exit “System Preferences” and enter again to see whether a layout is recognized.)
==============================
If there is an error in the file, an error message will be written to console.log, prefixed by "uchr XML compiler." If the error is an XML syntax error, the line in the file where the error occurred is given. Usually, only the first error encountered is diagnosed, and parsing is aborted.
Since console.log is erased when you log out and log in, to see error messages, force the keyboard to compile by opening International Preferences and switching to the Input Menu pane. Launching an application and typing will also force all keyboards to compile if the modification date of the directory has changed. If the keyboard does not appear in International Preferences, you can then check in console.log for error messages. To force the modification date on the directory to change, you can use the Unix touch command.
Console log:
console.log is pre-Leopard (10.5). You can see what used to be in console.log by running syslog -C in Terminal.
Launch the Console application (from the Utilities folder inside your Applications folder). It should open to All Messages, showing the log entries for everything that’s happened recently on your Mac. If you’ve previously narrowed the Console results, show the Log List and select All Messages before proceeding.
=============================== Some problems seen:
My problem was that my new custom keyboard layout would work in many apps - Spotlight, Sublime Text, the Terminal etc. - but not in many built-in apps such as TextEdit or Mail. The final point in the original question finally solved this issue for me:
sudo rm /System/Library/Caches/com.apple.IntlDataCache*
sudo find /var/ -name "*IntlDataCache*" -exec rm {} \;
(This is a fix of what is in https://support.apple.com/en-us/HT203221 )
=============================== Debugging on the fly
In 10.9, the error messages do not appear; however, one does not need to re-login when making changes
to a layout: it (dis)appears from the view when errors (dis)appear.
Action descriptions and Terminators are required. Extra action descriptions and terminators are tolerated;
duplicated terminators are not.
when-state must be reachable by an action (but the latter action may be unreachable). when-state=none is required.
Apparently, the state names are not entity-interpolated: they should match literally (as opposed to “after interpolation”).
Apparently, one cannot use state numbers near 0. Starting at 4100 works much better.
Apparently, a terminator for non-existing numeric state allows kbd to install, but it becomes grayed out later???
iz-Latin-hex6-vis3.keylayout
Or maybe the problem is with too many entries??? With iz-Latin-hex6-vis3a.keylayout:
it installs, but prohibits showing "long entries" in the the topbar's menu of possible keyboards
Out of Apple-keylayouts-v009-partially-works.zip:
Greek does not install
Cyr, Hbr install
Latin installs, but disables the keyboards menu
=== actually, these have a terminator for hex6 removed!
(and this is the only difference of Latin with klayout-009, which installs.
=========================
Problems which I have seen:
• A Layout does not appear as a choice in Keyboard Preferences > Other
• After a layout is activated, it shows in the left pane of "Keyboard Preferences", but not in the keyboards-menu of the menubar
• After a layout is activated, it soon becomes grayed out in the keyboards-menu of the menubar (after some crash???)
**Sometimes**, the first problem may be fixed by renaming the layout file, and editing its name inside the layout file.
=========================
modifying ./iz-Latin-hx3plus.keylayout:
Does not install:
These installs only intermittedly
These installs
(and one can have multiple sections of up to 256 states!)
==============================
There are some random situations where a keyboard layout is not recognized, or are printed out randomly.