All operating systems have a setting that will automatically lock the current user’s session if the user has been inactive for too long. User have the option to set how long this period of inactivity should be. Locking your screen is of course different from logging out of your system. A locked screen prevents others from accessing your desktop but logging out of a system will close the session you have open; your browser will be closed, Skype will exit, and so will any and all other apps you might have open. If you’re looking to automatically log out your Mac after a set period of inactivity as opposed to it just locking, OS X has a built-in function that lets you do just that. Here’s where it is.
Open the System Preferences and go to the Security & Privacy group of preferences. If the padlock icon at the bottom is locked, click it, and enter the administrator password if prompted to. With the preferences unlocked, an ‘Advanced’ button at the very bottom will appear and the ‘Allow apps downloaded from:’ option will no longer be greyed out. Click the ‘Advanced’ button.
The advanced security settings are where you can set your system to log out if you’ve been inactive too long. Clicking the Advanced button will open a pop-up that lets you enable the log out option and set the period of inactivity. Click Ok and you’re all done.
Logging out makes it so that if someone does figure your password out, they can’t get into your web browsing session or find your files too easily. It also means you won’t appear online over messaging apps when you’re away from your desk. It does mean that you’ll have to open multiple apps again when you return to work. You are effectively making a trade-off between security and productivity so choose carefully.