I always need at least two keyboard layouts, one for English and one for Thai.
(I could have used German layout for both English and German languages but LaTeX syntax is not German-friendly.)
Anyway, in the end, I got German keyboard and use English and Thai layouts.
To get two layouts of my choice, I could just set it through International setting in System Preferences like it is shown here.
....Except that it is not.
Sometimes and sometimes only, after I turn off the machine and turn it on again, the layouts mysteriously change back to German (which was my default one).
I was wondering for a long time why the layout does not stick.
Now, I know why.
Non-root users have no rights to change some preferences.
That's why when I change the layout, it switches back to the default one which was set by root when I installed the OS (which, unlike Windows, was eons ago).
To permanently change the layout, you have to access System Preferences as root.
To do so, type the following command in the Terminal (if you don't know what root or Terminal is, I guess it is better to ask someone who knows to do it for you. It is pretty safe to follow the next step, but just in case.):
sudo /System/Library/CoreServices/Setup Assistant.app\ /Contents/MacOS/Setup Assistant
Now, you can change your layouts as you like and it will stick.Please note that using sudo and do stuff as root is highly not recommended.
This is because you could potentially harm your system by doing things which you normally are not allowed to do.
However, if you just quickly set the layout and quit the Sys Pref, I think you are pretty safe.
This solution is originally posted here.