# Macbook Keyboard Fix



## greenyouse (Feb 22, 2012)

Hi all,
I had some trouble getting FreeBSD to work correctly in VirtualBox on my macbook (mid 2007 2.16 GHz model), so I thought it might be helpful to show how I enabled the function keys and scroll lock (slock) on my macbook.  Thanks to Harry Jensen for the info on how to tweak the keyboard map .

First go to apple/system_preferences/keyboard and check the box that says "use all F1,F2, etc. keys as standard function keys".  

Then start up FreeBSD and dump the keyboard map file to a new file called "mykeys"
`$ kbdcontrol -d >mykeys`

We'll change the "mykeys" file so "Ctrl+nlock" (nlock is numlock) will set "slock".

Find line with scancode "base" 069, or where "nlock" fills
 the entire line.  It should look like this


```
069 nlock nlock nlock nlock nlock nlock nlock nlock O
```

 Change column 3 from "nlock" to "slock"

 The line now looks like:

```
069 nlock nlock slock nlock nlock nlock nlock nlock O"
```

 Edit /etc/rc.conf

```
keymap="/home/xxx/mykeys" #where the file is
```

This is possible to test before you reboot. 

 As root, issue the command:
`# kbdcontrol -l mykeys`

Now hitting "fn+nlock" followed by "crtl+nlock" should allow you turn on scroll lock!  To take scroll lock off just enter the same two sequences.  Hitting "alt+f1,f2, etc." buttons will also allow you to switch screens between virtual consoles.

To use the function buttons like normal type "fn+f1, f2, etc."


----------



## nosmarterthanyou (Mar 14, 2012)

*Works, thank you!*

I just installed FreeBSD on a VM in VirtualBox on my mid 2008 MacBook Pro, and this was exactly what I needed to add a scroll lock capability.  My keyboard doesn't even have a numlock, so I set the slock on the control column for the number 4.  So, I just hit ^4 for scroll lock, then I can scroll with the arrows or page-up and -down with fn+arrow.


----------

