Resetting IMac without being logged in
I’m thinking of buying an iMac off of a friend. It is barely used, but they are selling bc they do not remember their logins and passwords and are locked out. Is there a way to completely wipe and reset the iMac without being logged in?