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

I wish to understand at a conceptual level, the difference between a terminal app, Command Line Interface (CLI), Command Line Tools (CLT) and Prompt. I am confused as to what the difference is between them?

The thing that threw me off was realizing that Apple does not ship macOS with CLT (Command Line Tools) pre-installed, and I have to download and install it separately. Doesn't that mean that Terminal.app is useless unless I download the CLT?

I am using zsh as my shell running on macOS Catalina 10.15.6.

## Clarification

My confusion is stemming from Xcode CLT. I don't understand what a CLT is?

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

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

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

I can't seem to wrap my head around these concepts and the connection between them.

• Comments are not for extended discussion; this conversation has been moved to chat. – bmike Sep 13 '20 at 19:09

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:

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.

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:

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)

• So, regarding my last question: is it a yes or a no? What I understood is that Homebrew is an app just like Apple's CLT. I interact with its CLI through Terminal.app. Wouldn't that make Terminal.app a GUI for the CLI? – CaptainCustard Sep 12 '20 at 10:21
• @CaptainCustard Like I mentioned in the answer, you can interpret the term "Command Line Tool" in two ways. "Command Line Tools" is a software package made available from Apple containing 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. And any command line app can be in general be referred to as a command line tool. (Just like Apple uses the term "App Store" to refer to their marketplace for iOS apps, while the same term could also be used in generic way). Hope it helps. – Nimesh Neema Sep 12 '20 at 10:44
• Really nice explained. – elulcao Sep 13 '20 at 3:33

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 %:

## 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.

• There are also the Xcode Command Line Tools which indeed need to be downloaded/installed separately. – nohillside Sep 10 '20 at 19:51
• 1) Is CLT a compiler? And if it is built in macOS, why do I need to download Xcode's CLT? 2) Why do I need an app like Terminal to access the CLI. Isn't the CLI an interface to begin with? 3) Does Homebrew (which is a package manager) considered a CLT that has its own CLI that I interact with using Terminal? – CaptainCustard Sep 11 '20 at 3:47
• @CaptainCustard Xcode Command Line Tools are an additional install which allows to compile applications from the command line (instead of using the Xcode application). – nohillside Sep 11 '20 at 12:21
• @CaptainCustard Ah, my bad. ruby is (as are perl or bash) part of each macOS installation, you don't need to install it separately. And it's not a compiler (which compiles/transforms source code into machine language), it's an interpreter which executes source code directly. – nohillside Sep 12 '20 at 5:00
• @CaptainCustard I have added that (prompt) to my answer. – Steve Chambers Sep 12 '20 at 13:44

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.

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

An interface is a method that applications use to channel information between you and the computer. Finder is an application that uses a graphical interface (at one point called a WIMP interface -- Windows, Icons, Menu, Pointer.)

CLI (Command Line Interface) is a method or mode of operating that an application like Terminal can use. Of course, technically, Terminal uses multiple windows, and WIMP elements like drag-and-drop.

• Would it be safe to say that apps like Terminal are GUI for CLI? – CaptainCustard Sep 11 '20 at 19:43
• It would certainly be witty. – benwiggy Sep 11 '20 at 22:04

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

As the name suggests, they're a collection of tools like git, svn, ranlib, ar, Clang compiler, GCC compiler etc. The CLT in /Library/CommandLineTools lacks xcodebuild for eg., which some apps need to compile their code

I'd say Xcode ones are the complete ones. BUT you don't need Xcode for normal functioning of your Mac and if you don't write code for macOS, iOS, WatchOS or TvOS.

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

You can have multiple Terminal-like apps like iTerm2 etc.

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

Brew also has many of the open source tools which come in macOS CLT or Xcode CLT. However Apple's proprietary SDKs can only be found in macOS/ Xcode CLTs. I haven't seen anyone referring to brew's packages as CLT. It'll simply be ambiguous.

• Fish is a shell not a "Terminal-like app", for the distinction see Steve's answer – thesecretmaster Sep 11 '20 at 12:16
• Thank you but none of my questions have been answered. Why do I need apps like Terminal to access the OS's CLI? (I wasn't asking if there are more apps like Terminal.app.) Terminology-wise, if Homebrew allows me to use certain commands to interact with the OS's CLI, wouldn't that make it a CLT? – CaptainCustard Sep 11 '20 at 19:40
• @CaptainCustard 1 Where else would you see the output thrown by a binary ? 2 Terminology-wise, your Mac is your personal computer, wouldn't that make it a PC ? You can use whatever you want.. I'm not enforcing it, but I will call it ambiguous. – anki Sep 11 '20 at 20:02
• @CaptainCustard The OS doesn't have a CLI as such, the OS just runs binaries/applications. One of those applications is Terminal in which you can run a CLI. – nohillside Sep 12 '20 at 5:01