On a Mac laptop, select System Preferences from the Apple menu, followed by Security & Privacy to lock and unlock the keyboard. Select Require Password after Sleep or Screen Saver Begins under the General tab. The drop-down box’s Immediately option offers the highest level of security.
Users who desire more protection can select Disable Automatic Log-In, in which case the keyboard locks when the user goes to sleep. From the Apple menu, choose Sleep to put a computer to sleep. Enter the password to wake up a computer from sleep mode. The keyboard and computer are both unlocked by the password.