Locking your Mac can prove to be a great way to make sure that any information displayed on your screen stays private. This way you can easily step away from your computer without having to worry that some passer-by will see any piece of information with an accidental glance. Maybe you just don't want other people in your office or at home to jump on your Mac, the moment you leave it unattended. Regardless of your reasons, here are several ways in which you can quickly lock your system with a password making it inaccessible without the proper credentials.
Add a password after waking up from sleep
The first method which you can lock the screen of your Mac with is by forcing your system to require a password after waking up from the sleep mode. Once you have done that, you can safely step away from your computer after putting it to sleep. Nobody can wake it up without typing in your password.
To achieve this, you will have to access the "System Preferences" menu, go to "Security" and simply click on the checkbox that states "Require password after sleep or screen saver begins", like you can see in the image below.
Set Sleep Password
Additionally, you can change the amount of time your Mac should wait before requiring a password by selecting any of the available options from the drop-down menu.
In case you don't already know this, you can quickly put your system to sleep by choosing the "Sleep" option from the Apple menu, by closing the display if you are using a notebook or by using the key combination "Command" + "Option" + "Eject" (or "Command" + "Option" + "Power" if your Mac doesn't come with an optical drive or an eject key).
Activate the screen saver using Hot Corners
Like I have stated before, if you have any application running in the background that you don't want to interrupt after locking your Mac's screen, then you can choose to activate the screen saver rather than putting your system to sleep.
In order to do that, you will have to check the password requirement box just like I've shown you above, then go to the screen saver settings ("Apple menu" > "System Preferences" > "Desktop & Screen Saver" > "Screen Saver") and click on "Hot Corner". A pop-up window will appear from where you can choose, using the drop-down menus, to start the screen saver the moment you hover your mouse cursor over the desired corner of your screen.
It might be a good idea to select a corner that you won't accidentally trigger with your mouse, like bottom-left corner, as you can see in the image above.
Use Keychain Access
If you don't like any of the presented methods, then you can always add a "lock screen shortcut" on your Mac's menu bar using Keychain Access. Simply open the app from the ~/Applications/Utilities folder and access its "Preferences" menu. Once there, check the box that will display it on your menu bar.
Now, all you have to do is click on the newly displayed lock icon from the menu bar and click on the "Lock Screen" option.
Keychain Lock Screen
To regain access to your Mac, all you need to do is provide your login credentials (username and password).
Turn on Fast User Switching
Another method which you can lock the screen on your Mac with is by turning on the "Fast User Switching" option that will allow you to quickly change the active user on your system directly from your Mac's menu bar.
So, how can switching between users lock your screen? It's quite simple. This feature gives you the possibility to instantly access the login window, where you will be required to provide the username and password in order to regain control of your computer.
To activate the "Fast User Switching" feature and place its icon on your menu bar, all you have to do is access the "System Preferences" menu, click on "Users & Groups" and select "Login Options". Now check the box next to "Show fast user switching menu as" and, optionally, select how the users will be displayed in the menu bar (full name, icon or short name).
Activate Fast User Switching
To access the login window, click on the your current username from the menu bar and select the "Login Window" option.
Access Login Window
As you can see, there are several ways in which you can lock the screen on your Mac so that you can prevent unwanted users to gain access to your system. I don't know why Apple didn't just put a simple lock button in the menu bar by default and forced you to activate these "not-so-obvious" features, but it's not that complicated to do it by yourself.
In addition to these methods of locking your computer's screen, there are also third-party applications like Lock Me Now or Quicklock App that can do this job. But, honestly, why bother downloading or purchasing them, when OS X provides you with all you necessary means to complete this task.
If you have any additional questions or comments, feel free to leave me a message in the section below.