When you connect an external keyboard to a Mac computer, the computer's Keyboard Setup Assistant utility helps the computer determine what type of keyboard is being used. If something goes wrong while the Keyboard Setup Assistant is determining what keyboard to use, the computer may assign a different layout to the keyboard, requiring you to reset the keyboard to the proper layout. If you want to reset an external Mac keyboard, delete the keyboard's preference file.
Disconnect the external keyboard from the computer's USB port.
Click the "Finder" icon in the computer's dock, then click the hard drive icon beneath the "Devices" heading.
Click the "Library" folder icon, followed by the "Preferences" folder icon.
Click on the file named "com.apple.keyboardtype.plist" and drag the file onto the "Trash" icon in the computer's dock.
Press and hold the "Ctrl" key and click on the "Trash" icon. Select the "Empty Trash" option from the context menu that appears.
Reconnect the keyboard to the computer's USB port. The Keyboard Setup Assistant will launch automatically. Follow the onscreen instructions to set up the keyboard.