MacOS turn off sync with iPhone for a while
Solution 1:
- Create a new user account (or enable the Guest user) on your Mac (System Preferences -> Users and Groups)
- Log out of your account
- Have your friend log in with the new or the guest account
Using a separate accounts prevents any messages from showing up, it also ensures that nobody will be able to mess with your data.
Solution 2:
I fully agree with the create a new account option. Save and simple. Don't make the account an admin either. For safety reasons. That way you don't have to fool around with your messages and other iCloud stuff.
If you do need him to use your account, then it's probably safest to sign out of your iCloud account. If you sync your data to the iCloud account as well, that is fairly save as well.
Downside is, that you will also lose "Find your Mac" that way. So you better be very trusting of your mate.
Solution 3:
To turn off iMessages on your Mac:
Click on the messages app:
Click Messages in the top bar and select Preferences.
The Accounts window will pop up, tap your Apple ID on the left column.
Uncheck Enable this account or click Sign Out.