How to prevent someone accessing my iMac
You can't make it truly secure; there is a saying that says given enough time, physical access is root access. That being said, there are some steps you can take to get as close as possible.

FileVault

Enable filevalult. This will keep people from accessing your data if they boot from an external drive.
To do this, go to System Preferences -> Security &amp; Privacy -> FileVault, and click Turn On FileVault. This will most likely require an admin password, and will probably take a very long time, depending on how much stuff is on your computer. That being said, it's worth it.

Screen lock

Enable auto-locking of your computer after a set amount of time. This can be done in System Preferences -> Security &amp; Privacy -> General. Check the box that says require password [5 minutes] after sleep or screensaver begins and change it to your desired amount of time.

Firmware lock

To prevent booting into single user mode or from an external disk without a password, enable firmware lock.

WARNING: THIS IS VERY HARD TO RECOVER FROM IF YOU LOSE YOUR PASSWORD. DON'T LOSE IT.

To do this, shut down your computer and turn it on while holding the Command+R keys. This will put you in recovery mode. Click the Utilities menu, and select the Firmware Password Utility. Click Turn On Firmware Password... and set a password. You will need it to boot from anything other than your main partition, so keep it safe! If you have an older Mac (Pre-2011, I think) there is a trick to get around this, but it requires removing the RAM, so it's pretty unlikely.