It’s pretty easy. You need your software install CDs or DVDs that came with your MacBook. On those discs are utilities that are used for installing the system software, but there are also other tools, such as the password change utility.
But what happens if you don’t have your OS X CD or DVD? Well, it’s possible to change the administrator password without the disc, but it’s complicated. Best thing to do is ask around to borrow an OS X CD/DVD. Ask friends; ask at the store where you bought your Mac. Look for a Macintosh User’s Group in your town (you can search for one here) and go to a meeting or email them to get help – they’ll help you for free. Or find out if there is an Apple Store in your town (search here) and go to the Genius Bar and they’ll help, too.
But if you have a CD or DVD, these steps are from the Apple Knowledge Base article Changing or resetting an administrator account password
Follow these steps to reset a password when there is only one administrator account on the computer, or if the original administrator account needs a password reset. “Original” administrator account refers to the one that was created immediately after installing Mac OS X. If the original administrator password is known, that administrator account may be used to reset the passwords of other administrator accounts using the steps described above.
1. Start up from a Mac OS X Install disc (one whose version is closest to the version of Mac OS X installed). Usually, you can start from the disc by putting it in your computer, restarting, and holding the C key. Or, put it in the computer and click the Install or Restore icon you see in the disc’s main window (after which the computer will start from the disc without you needing to hold C). Or, you can use Startup Manager.
2. Choose Reset Password from the Installer menu (or Utilities menu in Mac OS X 10.4 Tiger). Tip: If you don’t see this menu or menu choice, you’re probably not started from the CD yet.Note: The default keyboard layout is U.S. English while started from the installation disc. If you use a keyboard layout other than U.S English, use the Input menu (the flag icon on the right side of the menu bar) to select the desired layout before typing a new password.
3. Select your Mac OS X hard disk volume.
4. Select the user name of your original administrator account.
IMPORTANT: Do not select “System Administrator (root)”. This is actually the root user. You should not confuse it with a normal administrator account.
5. Enter a new password.
6. Click Save.
After following those steps, you’ll want to also follow the steps below to change your Keychain password. If you change the administrator password from booting from a CD or DVD, then your Keychain password will still be the old password that you forgot. So you need to go to Keychain Access and delete the old password and enter the new password when prompted.
From Keychain Access asks for keychain “login” after changing login password:
1. Open Keychain Access (you can get to it by choosing Utilities from the Go menu in the Finder).
2. In Keychain Access, choose Keychain List from the Edit menu.
3. Delete the “login” keychain.
4. Quit Keychain Access
After that, when you’re prompted to unlock the Keychain, enter your password and click “Always Allow” if you want Keychain to remember your password for you.
If you do remember your old password and want to make Keychain use your new password and you want your default keychain to be unlocked automatically when you log in, synchronize your Keychain Access and account login passwords by doing this:
1. Open Keychain Access (you can get to it by choosing Utilities from the Go menu in the Finder).
2. From the Edit menu, choose Change Password for Keychain “login.”
3. Type the former password of the account that you are currently logged in to, then click OK.
4. If you entered the correct password, a new window appears; enter the original password again in the Current Password field.
5. In the New Password field, type the password that matches your current account password.
6. Re-enter the newer password in the Verify field, then click OK.