It’s easy to make a user an administrator on OS X using the GUI tools. But if you do not have access to an existing admin account, this is impossible. By booting into Single-User mode, you can make a non-Admin into an Admin using the command line.

Here is how to do it.

  1. Shut down the computer.
  2. Hold down Cmd-s and power on the computer to boot into single-user mode.
  3. Once the computer is done booting, you will be at a shell prompt, logged in as the root user. Run the following commands:
    # fsck -fy
    # mount -uw /
    # launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
    # sudo dseditgroup -o edit -a yourlogin -t user admin
    # sudo dseditgroup -o edit -a yourlogin -t user wheel
    # reboot
    
  4. The computer will now reboot back into the normal graphical mode.
  5. Log in, and see that you are now an Administrator!