If you've been lucky enough to pick up a second-hand Mac from a friend, or have an older one that you intend to sell, then you'll want to reset the device so that it gets a clean start. But what happens if you don't know the password?

In this article we show how to get around this problem and restore the Mac to its factory settings even if you haven't got the password.

For more ways to improve your device, read our How to speed up a slow Mac guide, plus, How to find a password on a Mac.

Recover the password

Before circumventing the password on your Mac, you should know that it's not that difficult to reset the code. Every Mac has a built-in Recovery mode that will let you change the system password if it's been forgotten.

Read our How to recover a forgotten Mac password tutorial for a step-by-step guide to reseting your login details.

Wipe the contents of your Mac

As you'll be completely deleting all the content on your Mac, you'll need either a USB stick with a copy of macOS or access to an internet connection that can download several GBs worth of content, as this will be used to install macOS.

For more details on achieving this you can read our How to reinstall macOS using Recovery Mode guide.

Now you're ready to begin. First you'll need to turn off your Mac. Then press the power button and immediately hold down the Control and R keys until you see the Apple logo or spinning globe icon.

Release the keys and shortly afterwards you should see the macOS Utilities window appear.

How to reset a Mac without the password: macOS Utilities

In this are four options: Restore from Time Machine Backup, Reinstall macOS, Get Help Online and Disk Utility. Click on the last one and then select Continue.

Next, you'll see a list of all the HDs currently attached to your Mac. In the left columns are the names, while in the main panel are the details of the selected drive.

Look under the Internal section for your main drive. This is often called Macintosh HD and appears at the top of the list. Click on it so that it's highlighted, then click the Erase button from the options in the main panel.

How to reset a Mac without the password: Erase HD

A popup window appears with a few fields you'll need to complete. The first is Name, in which you should enter the title you wish to use for your new drive.

Under this are two dropdown menus. The first is Format, from which you should select Mac OS Extended (Journaled), while the second field is called Scheme and in here you need to select GUID Partition Map.

Finally, click Erase and the drive will be purged of all users, apps and content.

Of course, to be able to use your Mac you'll need to reinstall the operating system. To do this go back to the macOS Utilities menu, select Reinstall macOS and follow the onscreen instructions.

Hopefully, within a short space of time you'll have a fully functional Mac that's good to go. With all that spare room onboard, you might want to check out our Best free Mac apps roundup, so you can get the most out of your new machine.

Want to change the username on your Mac? Here's how to do that.