# MacOS Key Re-Mapping

UPDATE: This method no longer works on MacOS Sierra (10.12). I’ll post again when I find a new method.

I’ve been a Mac user on and off for over twenty years, but never really used one for serious work outside of basic web dev until quite recently. I’m not a full time coder, but I write enough code that the Mac’s lack of a # key really started to grate. I know it’s on option+3, but that’s always felt a little awkward, so I decided to look into remapping the keyboard so that pressing §, which I don’t think I’ve ever used intentionally, prints a # instead.

I’m used to linux where this sort of thing is pretty straightforward, but as it turns out it’s a little more complicated on MacOS.

A quick google search turned up a tool called Karibiner, which used to be called KeyRemap4MacBook. This is a really powerful tool, but if you want a custom option that doesn’t ship with it by default, you have to edit an xml file to provide the additional option. The documentation is really good but things get complicated fast and nothing really seemed to cover what I believe should be a fairly simple use case.

Below is the contents of my private.xml config file for Karibiner that prints a # when you press the § (Section) key.

#!xml
<?xml version="1.0"?>
<root>
<item>
<name>Put # on §</name>
<identifier>private.put_hash_on_section</identifier>
<autogen>__KeyToKey__ KeyCode::UK_SECTION, KeyCode::3, ModifierFlag::OPTION_L</autogen>
</item>
</root>

Hopefully this might be useful to someone else at some point.