Terminal is the macOS app that Apple ships in the Utilities folder to give users a text-based command-line interface to the operating system. The Terminal app emulates a classic hardware terminal, starts a shell (by default zsh), and passes typed commands to it, which makes it the entry point for Terminal & scripting work on macOS.
The Terminal app itself does not execute commands. It draws text, handles keyboard input, manages windows and tabs, and connects them to shell processes through a pseudo-terminal. This page covers the Apple application only; the general concept of a terminal on Linux is described separately.
How the Terminal app connects to the shell
When a new window opens, the Terminal app creates a pseudo-terminal device pair and launches the user’s login shell on it. Everything typed goes to the shell through this device, and everything the shell or its programs print comes back to be rendered in the window. Programs such as top or vim use escape sequences to move the cursor and change colors, and the Terminal app interprets them as an xterm-compatible emulator.
Since macOS Catalina, the default shell for new accounts is zsh, replacing bash. Apple still includes an old bash 3.2 for compatibility, because newer bash versions use the GPLv3 license. The shell can be changed per user in System Settings or with the chsh command.
| Layer | What it does | Example |
|---|---|---|
| Terminal app | Draws text and captures keystrokes | Window, tabs, profiles |
| Pseudo-terminal | Carries input and output bytes | A /dev/ttys device |
| Shell | Parses and runs commands | zsh, bash |
| Commands and tools | Perform the actual work | ls, diskutil, defaults |
| macOS kernel | Manages processes and files | XNU |
Features and settings of Terminal on macOS
Terminal offers profiles, which are saved sets of fonts, colors, window size, cursor style and shell behavior. A profile can run a startup command automatically, and different profiles can be assigned to different windows, which helps users visually separate local work from remote sessions.
Other built-in features include tabs and window groups, split panes within a window, Secure Keyboard Entry that blocks other apps from reading keystrokes, marks and bookmarks for jumping through long output, and window restoration after restart. Terminal also integrates with Finder: dragging a file into a window inserts its full path.
| Setting | Location | Effect |
|---|---|---|
| Default profile | Settings, Profiles | Look and behavior of new windows |
| Shells open with | Settings, General | Default or custom shell path |
| Secure Keyboard Entry | Terminal menu | Protects typed passwords from other apps |
| Use Option as Meta key | Profile, Keyboard | Enables Emacs-style shortcuts |
| Scrollback limit | Profile, Window | Number of lines kept in history |
| When the shell exits | Profile, Shell | Close window or keep it open |
Many settings can also be scripted. The defaults tool reads and writes the Terminal preference domain com.apple.Terminal, and AppleScript can open windows and send commands, which allows automated setups for new machines.
Terminal compared with alternatives and related tools
Terminal is the default, always-available choice, but it is not the only terminal emulator for the Mac. Power users often compare it with third-party apps, while scripting tools such as Script Editor solve a related but different problem.
| Tool | Type | Typical reason to choose it |
|---|---|---|
| Terminal | Built-in terminal emulator | Preinstalled, stable, well integrated |
| iTerm2 | Third-party terminal emulator | Advanced splits, search, triggers |
| GPU-accelerated emulators | Third-party terminal emulators | Fast rendering of heavy output |
| Script Editor | AppleScript and JXA editor | Automating apps rather than shells |
| Shortcuts | Visual automation app | Workflows without writing code |
Whatever emulator is used, the shell and the command-line tools underneath are the same. A script written and tested in the Terminal app runs unchanged in iTerm2, because the emulator only changes the presentation, not the behavior of commands.
Common tasks performed in Terminal
Terminal gives direct access to macOS-specific command-line tools that have no full graphical equivalent. Administrators and developers use it daily for diagnostics, configuration and package installation, often through tools listed below.
| Task | Command | Purpose |
|---|---|---|
| Change hidden preferences | defaults write | Adjust settings not shown in the interface |
| Manage disks | diskutil list | Inspect, erase or repair volumes |
| Search with Spotlight | mdfind | Query the Spotlight index |
| Prevent sleep | caffeinate | Keep the Mac awake during long jobs |
| Install developer tools | xcode-select --install | Add compilers and Git |
| Update the system | softwareupdate -l | List and install macOS updates |
Package managers such as Homebrew and MacPorts are also installed and operated from Terminal. They add open-source tools that macOS does not ship, and they typically require the Xcode Command Line Tools first.
Permissions, risks and common mistakes
Terminal runs commands with the privileges of the logged-in user, and sudo raises them to administrator level after a password prompt. Because a single mistyped command can delete files or change system settings, users should understand any command before pasting it, especially commands copied from web pages.
macOS adds protective layers. Transparency, Consent and Control (TCC) blocks access to protected folders such as Desktop, Documents and Mail data until the user grants Terminal Full Disk Access or a specific permission. System Integrity Protection prevents even root from modifying core system files, which is why some old tutorials fail on current macOS releases.
- Pasting unknown commands: social-engineering attacks often ask users to paste a malicious one-liner.
- Granting Full Disk Access casually: it extends to every program launched from Terminal.
- Assuming bash syntax: some bash scripts behave differently under zsh.
- Forgetting quotes around paths: file names with spaces break unquoted commands.
In everyday language
Terminal is a window where you talk to your Mac in typed words instead of clicking. You type an instruction, press Return, and the Mac answers with text.
It is a bit like phoning a very literal assistant who follows instructions exactly. That makes it fast and powerful, but also means it will not ask whether you really meant something risky. Most people never need it, yet it is always there when a precise task calls for it.
Seen in the real world
An IT technician at a design studio prepares twelve new MacBook laptops for staff. Clicking through the same settings on each machine would take most of a day, so she opens Terminal and runs a short zsh script she maintains.
The script installs the Xcode Command Line Tools and Homebrew, adds the studio’s standard utilities, shows hidden file extensions with defaults write, and confirms the disk layout with diskutil list. She grants Terminal Full Disk Access only for the setup session and removes it afterward.
Each laptop is configured in about fifteen minutes, every machine ends up with identical settings, and the script is reused for the next hiring wave.