How can I switch to non-default variant of keyboard layout on macOS?

Solution 1:

You can make a custom layout that does what you want with Ukelele.

Someone has already done something like this here.