The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Configure Kali to use the MacBook keyboard

posted on 15.8.2023 by Below Surface in "Kali Linux"

Step 1: Do the basic layout configuration

sudo apt install keyboard-configuration
sudo dpkg-reconfigure keyboard-configuration

Pick

MacBook/MacBook Pro

Select your language layout, then hit enter for the following options, or select something other than the default if needed.


Step 2: Make the cmd button work, as it would in MacOS

sudo nano ~/.Xmodmap

Paste this code:

clear control
clear mod4

keycode 105 = keycode 206 =

keycode 133 = Control_L NoSymbol Control_L keycode 134 = Control_R NoSymbol Control_R keycode 37 = Super_L NoSymbol Super_L

add control = Control_L add control = Control_R add mod4 = Super_L

Save and close the editor with

ctrl + o
enter
ctrl + x

Then run the file to test it:

xmodmap ~/.Xmodmap

And if it works for you, add it to the system startup:

sudo nano /etc/init.d/custom-startup.sh

Add this code:

#!/bin/bash
xmodmap ~/.Xmodmap

Then save and close the editor. Run:

sudo chmod +x /etc/init.d/custom-startup.sh

Then add it to cron:

crontab -e

Add:

@reboot /etc/init.d/custom-startup.sh

Save and exit, optionally test:

crontab -l

Restart the machine, and see if it the cmd key still works as desired!


Step 3 would be to make the @ button work, but this is still work in progress.

Tags:

kali
linux
macbook
cmd key
keyboard layout

Sources:

https://superuser.com/questions/1752123/i-am-using-a-macbook-pro-and-how-to-type-special-characters-like-and-in-kalihttps://askubuntu.com/questions/131900/how-do-i-switch-the-command-key-and-control-key-on-a-macbook-prohttps://www.tutorialspoint.com/run-a-script-on-startup-in-linux

More posts of this category

Installing Kali Linux on a 2012 Macbook Pro

How to switch from MacOS to Kali Linux on the A1398

Kali Linux

Installing Postman on Kali Linux

Follow these steps to install the API testing tool on Kali

Kali Linux

Installing Google Chrome on a Kali Linux machine

How to install the Google browser on Kali

Kali Linux