Simply learn yourself.
For iMac

How to turn on your iMac in safe mode

Turn On Your Imac In Safe Mode

Safe mode is useful in case normal OS X operating system is not booting up in your iMac. It can help you in saving documents or troubleshoot issues that you are facing. There are basically two methods to enter into safe mode either by using keyboard or by entering commands in terminal. However, this instruction page will instruct you to turn on your iMac in safe mode using keyboard method.

Step 1: In order to enter in safe mode, you need to boot from a power down machine. Shut down your iMac and wait till it get properly turn off. Now, turn on the machine.

Step 2: Gently press and hold shift key as soon as you hear the startup sound. Keep holding shift key until you see the Apple Logo. Release the key once the logo appeared.

Step 3: Now, wait while OS X boot in Safe Mode. ‘Safe Mode’ will appear in right corner of the screen. Log in with username and password.

Step 4: Once you are done with safe mode, reboot to normal mode by restarting it.