Apple - Can anyone explain to me the difference between terminal apps, CLI, CLT and Prompt?

CLI (Command Line Interface) is a general description of an interface that you interact with by typing commands. On the Mac your primary CLI is Terminal.app. On Windows it is PowerShell or Command Prompt. On the old Amiga OS it is simply called "CLI".

Terminal is the program or application ("app") that is used to access the Command Line Interface. On macOS terminal is located in the /Applications/Utility folder and called Terminal.app. There are alternate terminal applications (on macOS and Linux/Unix) that provide other features in the same way that Apple's Pages app offers word processing features presented in and implemented in different way that Microsoft Word.

Command Line Tools Are indeed shipped with and easily accessible in macOS using the Terminal.app. Since macOS is based (originally) on the Berkeley Standard Distribution Unix (usually called BSD Unix, or just BSD), it comes with (pretty much) the standard suite of Unix command line tools. This will be similar (with some significant differences) to the command line tools shipped with most Linux distributions.

Shell Though you did not mention this it is important to understand that macOS (and many Unix and Linux distributions) ship with a number of shell programs. Until recently macOS shipped with BASH as the default shell, more recently changed to ZSH, though BASH is still available. The differences in shells are subtle (to casual users) but define, in (slightly) different ways, the environment we use to run the command line tools. For most people the actual shell you use is unimportant. For programmers and system administrators the shell they use is vitally important to provide a customizable environment suitable to their specific needs.

Prompt is the character or characters that the shell presents in the terminal.app to indicate it is waiting for input. EG it is prompting you to type something. I have modified my prompt from the default so yours will look different than mine (below) where the prompt character is %:

My terminal prompt

TDLR

You have the command line tools built-into macOS. They are accessed using the Terminal.app (that then uses the ZSH shell).

You can download other standard Unix versions of these commands if the current ones don't do the job you want, the way you want them to, or are just plain missing. One of the more popular repositories of open source commands is Homebrew.

Homebrew is by no means necessary to the functioning of macOS but depending on your needs and desires in an operating system, they may provide good (or just familiar) alternatives to what Apple ships with its operating systems.


Adding to the excellent answer by Steve Chambers:

Historically, the term Terminal was used to refer to a communication device that lets user interact with a centralized computer. A terminal provided an input/output device in the form of a keyboard and display.

The days of mainframes with remote access are no more, and, with almost everyone having access to a fully capable computer of their own with dedicated CPU and memory, usage of the term Terminal is now a misnomer, and thus, it's more appropriate to use the term Terminal Emulator as the Terminal.app is emulating a terminal device and the same macOS operating system which is running the Terminal.app is also running the shell program with which the user actually interacts.

Thus, in the current age where we no longer use real terminals, the term terminal refers in short to a Terminal Emulator.

macOS comes with a built-in terminal emulator called Terminal.app, however, there are 3rd party alternatives available with extended feature set. One such very popular 3rd-party terminal emulator program is iTerm2.

Command Line Interface or CLI for short is a general term to refer to a computer user interface where the primary mode of interaction is via typing commands which adhere to a specific syntax. It is in contrast to the Graphical User Interface or GUI which is prevalent in modern day computing devices.

While macOS comes pre-installed with a variety of UNIX command line tools, Apple's Command Line Tools or CLT is the term used to refer to a specific installable package made available by Apple for software developers. CLT, in addition to the UNIX tools pre-installed in macOS, installs macOS SDK, headers, and build tools such as Apple LLVM compiler and Make. It enables developers to build and install open source software. For details, refer to this link: https://developer.apple.com/xcode/features/

It's worth noting that the term Command Line Tool can be interpreted in two ways. Command Line Tools is a software package made available by Apple which contains a specific set of items. Command Line Tool(s) in general could be used to refer to any tool/app which is interacted with via a command line interface (Homebrew is latter of the two). And any command line app can be in general be referred to as a command line tool. (Just like how Apple uses the term App Store to refer to their marketplace for iOS apps, while the same term could also be used in a generic way).

Prompt or Command Prompt is another commonly used term to refer to the command line interface. A prompt is generally used to indicate the location for users to input command line (i.e. sequence of characters describing the entire command). A command prompt may use a special character to give some idea about the shell in use or the logged in user. E.g., BASH shell uses $ for the prompt character, while ZSH uses % for the prompt character. Prompt for the root user is almost always #. A prompt is generally followed by a blinking cursor to indicate the place for text entry.

Here's a depiction of a command prompt running BASH shell in Terminal.app in macOS for a non-root user. The part underlined in green indicated the prompt in the shell which is accessed by the user using the Terminal app:

command prompt running BASH shell in Terminal.app in macOS for a non-root user


To answer your specific questions:

The thing that threw me off was realizing that Apple does not ship macOS with CLT (Command Line Tools) and I have to download it.

macOS doesn't ship with Apple's CLT because most users of Mac (even most software developers) would never ever need it. And once you have a need for Apple's Command Line Tools, Apple has made it very easy to install them.

Doesn't that mean that Terminal is useless unless I download CLT?

Terminal is very much useful and usable for a variety of tasks, even for many software developers even without Apple's Command Line Tools installed. Most software developers would never install Command Line Tools and yet they can access any one of the built-in shells, run shell internal commands, execute shell scripts, run one of the numerous, pre-installed external commands etc. Only for the developers needing access to specific tools provided by CLT, would they need to obtain them by installing it.

Is it a compiler? And if it is built in macOS, why do I need to download Xcode's CLT?

No CLT is not a compiler, or aptly speaking, it contains a compiler (Apple LLVM) as one of the apps in its package of tools. Command Line Tools have been aptly described by Apple here:

Apple Command Line Tools

Why do I need an app like Terminal to access the CLI. Isn't the CLI an interface to begin with?

Installing Apple's Command Line Tools installs a package containing header files, SDKs and various command line apps in macOS. Terminal.app is then used as an interface to gain access to the tools themselves.

Does Homebrew (which is a package manager) considered a CLT that has its own CLI that I interact with using Terminal?

Homebrew is a community developed, open source, 3rd-party package manager which makes it simple to manage installation of command line apps/utilities which Apple doesn't ship. It takes away the hassle of compiling/installing/configuring/managing/uninstalling a variety of open source command line utilities, which could be a hassle for a majority of users (software developers included).

Homebrew itself becomes available to users as a external command itself that lets them manage other command line utilities. It is an app/utility which is different from Apple provided Command Line Tools.

(To further clear any confusion, when referring to Apple's Command Line Tools, it is implied that one is talking about the specific package containing multiple tools made available by Apple, though the term itself sound pretty generic (like other terms Apple use such as App Store). Apple's Command Line Tools should not be confused with command line tools when referenced to in general)


Adding to the answers already given, I want to give a bit more detail on the distinction between (physical) terminals and terminal emulators.

Physical terminals can be imagined as special typewriters that communicated via serial, hence Tele-Typewriter, or, TTY for short. This was in the age where multiple users shared one big server (e.g. in a university) and logged into that central point via their terminal endpoint which provided an interface to the system.

With the age of personal computing, but before graphical user interfaces, the terminal and the terminal server merged into one device. To preserve the same environment, the computers added virtual terminals, or VT. On Linux you can access VT1–7 via the key combination Control + Alt + Shift + Fx.

On macOS you can enable your login mask to not show you the available users but instead provide a text input field. If you type >console as user you will be then dumped into a "full screen" text only virtual terminal. As these VTs emulate the serial line and limited input/output of physical terminals they have rather similar restrictions.

With the age of graphical user interfaces, the GUI desktop replaced the VT. In order to still be able to run CLI tools, Terminal Emulators were developed which are graphical applications/windows designed to connect to what is called pseudo terminals (PTY), which are essentially headless and ad-hoc creatable VTs.

This is why we have abbreviations such as TTY, VT and PTY which all describe rather similar, yet slightly different, things.