Turn the device off and on
Magic Mouse has a switch on the bottom of the device, and Magic Keyboard and Magic Trackpad have a switch on the back edge of the device. Slide the switch to turn off the device (no green is visible), then slide the switch back to turn on the device (green becomes visible).
Earlier Apple Wireless Keyboard and Magic Trackpad models have a power button on the right side of the device. Hold the button until the green LED on the top of the device turns off, then press the button again until you see the green LED to turn the device on.
Make sure Bluetooth is turned on
Using your Mac laptop's built-in trackpad or a USB mouse, choose Apple menu > System Preferences, then click Bluetooth. Make sure that Bluetooth is turned on.
If you don't have a USB mouse and your keyboard is connected, press Command-Space bar, enter Bluetooth File Exchange in the Spotlight search field, press the Return or Enter key, then press the Return or Enter key to turn Bluetooth on.
If you still can't turn Bluetooth on, restart your computer, then try to turn Bluetooth on again.
Connect the Lightning cable
Connect your wireless accessory to your Mac with the Lightning to USB Cable or USB-C to Lightning Cable, wait 1 minute, then disconnect the cable. This pairs the accessory with your Mac and charges the built-in battery. To check your accessory's charge level, click the Control Center icon in the menu bar, then click Bluetooth.
Earlier models don’t use a Lightning cable for charging, but have batteries that you replace. Learn how to pair those devices with your Mac.
Check for wireless interference
If your accessory won't stay connected wirelessly, there might be interference with other wireless devices. Learn how to resolve Wi-Fi and Bluetooth issues caused by wireless interference.