Change the batteries in an Apple wireless keyboard, mouse or trackpad
When you change the batteries in a device, replace all of them at the same time with the same kind of battery. Dispose of batteries according to local laws and regulations.
If you’ve never connected your mouse, trackpad or keyboard with your Mac, you need to do so. See Connect a Bluetooth device with your Mac.
If you’ve previously connected your mouse, trackpad or keyboard with your Mac, you don’t need to do it again after replacing the batteries. It should automatically reconnect with your Mac a few moments after you turn it on. If it doesn’t, click the mouse or trackpad or press a key on the keyboard to reconnect it to your Mac.