Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.
The Terminal app is your gateway to the command line in macOS. It provides an interface with a shell or command interpreter that takes your command and invokes others to perform both routine and complicated tasks.
If you’re just getting started or spend considerable time in the Terminal, you might want to customize the look, feel, and various attributes. We’ll show you some interesting ways to customize the Terminal and make it work best for your environment and workflow.
Basics of the Terminal Window
When you open the Terminal app, you’ll see a nearly empty window with two lines of text. The first line reveals the date and time of your last login. For example:
Last login: Wed Feb 13 01:08:35 on ttys000
The second line is the actual command prompt; that rectangular box at the end is your cursor. You’ll type commands on this line:
Here’s what each of those elements mean:
- The first part of the prompt is the name of your Mac. The colon (:) is a visual separator.
- The second part begins with a tilde (~). It indicates that you’re in the home directory and uses a short user name.
- Finally, the dollar sign ($) means that you’re logged in as a non-root user.
Modify the Terminal Window
The Terminal window behaves just like any other app in macOS. You can minimize, move, resize, zoom, and scroll through the content. After you’ve used Terminal for any length of time, the commands you type will produce a lot of text.
This text is small, hard to analyze, and can make it difficult to locate the cursor. Although you can resize the window, those changes are lost when you quit the app.
To modify the Terminal window, go to Shell > Show Inspector or press Cmd + I to open the Inspector window. Under the Window section, enter values into the Columns and Rows field or resize the window to your liking to fill those values automatically.
Once you get the Terminal window to a particular size, shape, and position, choose Shell > Use Settings as Default.
Tweak the Terminal Theme
The default Terminal comes with black text on a white background. But you can customize its various attributes like background color, font (typeface and size), text color, cursor type, and much more.
Navigate to Shell > New Window and try some of the built-in themes. These include Grass, Homebrew, Man Page, Ocean, Red Sands, and more.
The Preferences > Profiles pane displays all the prebuilt themes. It shows visual thumbnails on the left sidebar and attributes on the right panel. This is split into six sections: Text, Window, Tab, Shell, Keyboard, and Advanced.
To tweak the attributes, select a theme and choose Duplicate Profile from the Gear menu.
Terminal allows you to customize various text attributes. To change the font used, click the Change button in the Font section and choose a font typeface and size.
You can apply text smoothing, use bold fonts, use bright colors for bold text, and more. If you wish to change the color of the text, click the Text color and select an option.
To change the cursor shape, select Block, Underline, or Vertical Bar. Click the color button next to the word Cursor to change its color, too. You can make the Terminal window transparent by adjusting the Opacity and Blur sliders.
In this way, you can put a Terminal window directly above a web page and type in commands as you read the instructions.
The window attributes include title, size, scrollback limit, and other behaviors. Remember, the options you choose in this pane apply only to the profile, not the entire Terminal app. To change the name of the window, type new text into the Title field.
Select any or all of the checkboxes to display name of the active process, working directory, path, shell name, and more. You can change the default window size for the current theme and even configure the size of scrollback buffer to save the history of commands you typed into Terminal days or weeks ago.
In this section, you can fine-tune how Terminal works. You can choose a command to run on startup; for example, start an alternate shell. It’s also possible to have Terminal prompt you before closing the windows. Set Ask before closing to Always to prevent accidentally killing it, or set it to Never if you find that prompt annoying.
If you check Only if there are processes other than the login shell and, Terminal will alert you before you quit the app. This feature is useful if you accidentally click the wrong window element or press the wrong key sequence.
Working With Window Groups
Do you like to have your Terminal windows arranged in a particular way and want to resume a session without having to rearrange and relaunch? The Window Groups feature will save you time and increase your productivity. Using it, each window can have its own process, attributes, and position on the desktop.
For example, you might be editing a file with Vim in one window and running Octave in another. Perhaps you want to refer the program’s man page in one window while trying out the command in another window. And if one shell is busy in performing long tasks, you might want to run a command in another window.
Saving a Window Group
Before you establish a window group, you’ll need to:
- Organize windows onscreen as desired.
- Tweak the attributes, size, and shape of each window.
- Run any commands for each window that you want to resume.
Then choose Window > Save Windows as Group. Type in a name, check Use window group when Terminal starts, and click Save.
Restore the Window Group
To restore the window group, choose Window > Open Window Group. That way you can keep working on your current shell but open the group any time you need to run a specific set of tasks.
Open Preferences > Window Groups and click the Gear icon to import, export, or delete window groups. If there are other application windows, assign the window group to a separate desktop workspace to avoid distractions.
Setting Up the Default Shell
The default login shell for macOS is the bash shell. However, it also offers a host of different shells, including /bin/bash, /bin/csh, /bin/zsh, /bin/ksh, and more. Unix enthusiasts love to work with the zsh (or Z) shell because it offers many features on top of the bash shell and supports dozens of plugins.
If you’re a newbie, sticking to the default bash shell for now is fine. But you should know how to switch them when needed.
Find Out Which Shell You’re Using
To find out which shell you’re using, type in this command:
The Terminal shows you the shell name, preceded by a hyphen.
Change the Login Shell
To change the default shell for your user account, open System Preferences > Users & Groups. Click the lock icon and enter your administrator credentials. Then right-click your name from the list and choose Advanced Options.
In the dialog window that appears, change the option under Login shell. You don’t have to restart your Mac for this to take effect; just quit and resume the Terminal session to start with a new shell.
To change the default shell Terminal for any user account, choose Terminal > Preferences and click General on the toolbar. Next to Shells open with, select Command (complete path) and enter the path to your new shell in the field.
Customize the Command Prompt
The default command line prompt shows you the same information every time you open the Terminal. There are many special character sequences that, when used to define the prompt, can reveal interesting bits of data.
The appearance of the prompt is stored in the environment variable $PS1. When you type in the following:
The resulting text is string-coded with the default settings of the shell prompt in this format:
- \h represents the host computer name
- \W is the current working directory
- \u stands for current user
On macOS, .bash_profile can contain a variety of preferences for how you want the shell to look and behave. The customizations you make in .bash_profile apply only to a shell session; they don’t apply to shell scripts. To edit .bash_profile in nano, type in:
In the new line, add PS1=”…”. In between those quotation marks, put a sequence of characters to customize the prompt. There’s acomprehensive list of prompt special characters in the bash documentation manual. For example:
- ! represents the history number of this command
- \d is the date in weekday/month/date format
- \u stands for username
- $ is effective UID
Once you type in the sequence, press Control + O to write the new information. Then press Control + T to save this information into the .bash_profile file. Quit and relaunch Terminal to see the changes.
One prompt sequence that I like is:
PS1="\w \! \$"
Give this a try and see if you like it. On a multiuser system, you can put the hostname, username, bash version, history number of command, and more to get more information.
Try Some Terminal Alternatives
The Terminal app has been the default command line interface for decades. Whether you’re just getting started or have used Terminal for a long time, these customizations can make you more productive. Like most Apple apps, Terminal tries to strike a balance between accessibility for new users and power features for developers.
To become a power user of the command line you need more features, like split-pane support, autocomplete suggestions, search, paste history, and more. Check out these useful Terminal alternatives that can fit your workflow.