There is no "Command Prompt" on a Mac; the equivalent tool is Terminal, which runs the Unix shell (zsh by default) and accepts the same kind of text commands. To open it, press Command+Space, type Terminal, and press Return — or go to Finder > Applications > Utilities > Terminal. Everything below explains what you need, how to use it safely, and what to do when a command misbehaves.

What You'll Need

  • A Mac running a current version of macOS (the steps are written for macOS Ventura or later; labels can differ slightly by version, device or region).
  • An administrator account if you plan to run commands that change system settings (many everyday commands do not need one).
  • Basic familiarity with typing exact text — Terminal does not guess or autocorrect commands.

Step-by-Step

  1. Open Terminal. Press Command+Space to open Spotlight, type Terminal, and press Return. Alternatively, open Finder, choose Go > Utilities from the menu bar, and double-click Terminal. The window that appears shows a prompt ending in % (or $ on older setups), which means the shell is ready.
  2. Check where you are. Type pwd and press Return. This prints the current working directory, usually your home folder (/Users/yourname). Knowing this prevents running commands in the wrong place.
  3. List files. Type ls and press Return to see the contents of the current folder. Add -l for a detailed list (ls -l). This is the Mac equivalent of the dir command on Windows.
  4. Change folders. Type cd followed by a space and a folder name, for example cd Documents, then press Return. Use cd .. to go up one level and cd ~ to return to your home folder. Tip: type the first few letters of a folder name and press Tab to autocomplete it.
  5. Run a simple command. Type date and press Return to print the current date and time. This confirms the shell is working before you try anything that changes files.
  6. Create a test folder. Type mkdir testfolder and press Return. Then type ls to confirm it appears. You can remove it later with rmdir testfolder (only works if the folder is empty).
  7. Read a file without editing it. Type cat followed by a filename and press Return to print its contents to the window. For long files, use less filename and press Q to quit.
  8. Clear the screen. Type clear and press Return, or press Control+L, to tidy the window without deleting anything.
  9. Close Terminal. Type exit and press Return, or press Command+Q. Closing the window ends the session; any command still running will be stopped.

Common Mistakes

  • Typing commands from Windows guides. Commands like dir, copy, del and ipconfig do not exist in the Mac shell. Use ls, cp, rm and ifconfig (or ipconfig getifaddr en0) instead.
  • Forgetting spaces. cdDocuments is not the same as cd Documents. The shell treats the whole string as one word and returns "command not found".
  • Assuming commands are reversible. Commands like rm delete immediately — there is no Trash and no undo. Read a command carefully before pressing Return, especially if it contains sudo or a wildcard like *.
  • Ignoring the prompt. If the prompt shows # instead of %, you are running as the root user, which can change anything on the system. Exit that session unless you specifically need it.
  • Pasting commands from unfamiliar sources. A pasted command can do anything you could type yourself, including deleting files or changing permissions. Only run commands you understand.

Tips

  • Use Tab to autocomplete file and folder names, and the Up arrow to recall previous commands. Both reduce typing errors dramatically.
  • Press Control+C to stop a command that is still running (for example, a long ping). This is safe and does not damage anything.
  • If you need to run a command with administrator rights, prefix it with sudo. macOS will ask for your login password; nothing appears on screen as you type it, which is normal.
  • Keep a plain-text note of commands you use often. Terminal has no built-in command library beyond history, and history is lost when the session ends.
  • To change the shell's appearance or default shell, use Terminal > Settings. Changing the default shell is optional; zsh is the macOS default and is fine for almost everything.
  • If you only need one command, you can run it without opening Terminal by using the Script Editor or an Automator "Run Shell Script" action, but for learning, the Terminal window is clearer.

Troubleshooting

  • "Command not found." Check spelling and spacing first. If the command is a tool you installed, confirm it is on your PATH by running echo $PATH. Reinstalling the tool through its official installer is usually the quickest fix.
  • "Permission denied." You are trying to change a file or folder your account does not own. Check with ls -l. Only use sudo when you understand what the command does; do not run sudo on everyday file commands out of habit.
  • Terminal opens but nothing types. Click inside the window to make sure it has focus, then try again. If the window is frozen, quit Terminal with Command+Q and reopen it.
  • A command seems stuck. Press Control+C to cancel it. If that does not work, close the window; the process ends with the session.
  • You pasted a command and it did something unexpected. Stop and do not run further commands. Check what changed with ls -l in the affected folder. If files were deleted, restore them from a backup (Time Machine or another backup you keep). Terminal has no undo, so a backup is the only recovery route.
  • You need to reset Terminal's settings. Quit Terminal, then reopen it while holding no keys; if problems persist, delete Terminal's preferences file from ~/Library/Preferences (this resets window and profile settings, not your files).

Frequently Asked Questions

Is Terminal the same as Command Prompt?

Functionally yes: both are text interfaces for running commands. The commands differ because macOS uses a Unix shell (zsh) while Windows uses its own command interpreter. Most everyday tasks have equivalents, but the exact syntax is not interchangeable.

Can I run Windows commands on a Mac?

Not natively. Some tools exist to emulate Windows command-line behaviour, but they are separate software and not part of macOS. For most tasks, learn the Mac equivalent instead.

Do I need to be an administrator to use Terminal?

No. You can list files, navigate folders and run many commands as a standard user. Only commands that change system-wide settings or protected files need administrator rights, which you grant per command with sudo.

Is it safe to use Terminal?

Yes, if you understand the command before running it. The risk comes from commands that delete or modify files, especially with sudo or wildcards. Keep backups and avoid pasting commands from sources you do not trust.

How do I close Terminal without stopping a running task?

You cannot keep a task running after the window closes in the default setup. If a command must finish, leave the window open until it completes, then close it.

Where can I learn more commands?

Run man followed by a command name (for example man ls) to read its built-in manual. Press Q to exit the manual. Apple's own support pages also cover Terminal basics.