Sure, here is a new blog post based on the information provided:
Remapping Keys Permanently in MacOS Using LaunchAgent
In my previous post, I discussed how to temporarily remap keyboard keys in MacOS. However, if you want to make this change permanent every time you login into your account, you can use the LaunchAgent features. In this article, I will show you how to do it.
Creating the Folder and Script
First, create a new folder under your own directory (e.g., .lm_scripts) and place the script inside it. The script should be similar to the one I provided in my previous post:
#!/bin/bash
hidutil property –matching ‘{“ProductID”:0x221,”VendorID”:0x5ac}’ –set ‘{“UserKeyMapping”:[{“HIDKeyboardModifierMappingSrc”:0x700000063,”HIDKeyboardModifierMappingDst”:0x700000037}]}’
Give the script executable permissions by running the following command:
chmod +x remapping.keys.sh
Creating the .plist File
Next, create a new .plist file with your favorite editor. I called mine com.remapping.keys.plist. The content should look like this:
Label
com.remapping.keys.app
Program
/Users/lorenzo/.lm_scripts/remapping.keys.sh
RunAtLoad
Note that the program string must reflect your user and the path where the script remaping.keys.sh is present.
Placing the .plist File
Place the file under ~/Library/LaunchAgents/.
Now, at your next login, the keys of your keyboard will be re-mapped as desired.
That’s it! You have successfully remapped your keyboard keys permanently in MacOS using LaunchAgent.