How To Customize Your macOS Terminal

Charles Dobson
8 min readNov 5, 2019


If you’re like me, you have a Terminal window open all the time. Assuming you haven’t customized your Terminal yet, it probably looks something like this:

It’s fine and functional, but it’s not exactly pleasant to look at or work with. I’m going to take you through customizing it to make for a much better Terminal experience. We’ll be configuring it to match my preferences, so make sure you tweak it to match yours! Once we’re finished, it’ll look something like this:

EDIT: In this tutorial, I’m using the bash shell. Newer versions of macOS default to using zsh instead of bash. If you have no problem with switching back to bash, simply open a Terminal, type the command chsh -s /bin/bash , then close and reopen the Terminal.

Step 1: Setting A Theme

Firstly, let’s set a theme. Start by clicking on your Terminal window and selecting Terminal > Preferences. Here you’ll see a list of some default Terminal profiles that you can use. Instead of using one of these, I’m going to add in a custom theme from here — If you’re following along, set that up for now and you can always change it later! You can simply clone the repository with

git clone

open the directory, and then drag the scheme/terminal/One Dark.terminal file into your Terminal Profiles list. You should see it pop up here:

Select the One Dark profile and press the Default button at the bottom of the list to set it as your default.

To apply some of the changes in this guide, you’ll need to open a new Terminal window. Go ahead and do that now to see the new colour scheme applied.

Step 2: Setting Preferences

Let’s go ahead and set some basic preferences. I’ll list out the changes I made. Follow along and make any other changes you think you’d like!

Text Tab

Font: Menlo Regular 13 pt
Text: Deselect Use Bold Fonts and Allow Blinking Text
Cursor: Select Vertical Bar and Blink Cursor

Window Tab

Title: Deselect Active process name, Arguments, Dimensions

Tab Tab

Title: Deselect Path, Active process name, Arguments, Show activity indicator

Shell Tab

Startup: Select Run command: and add ‘clear’ to the textbox, select Run inside shell

Keyboard Tab

Select Use Option as Meta key

At this point, let’s reinitialize the Terminal and see what it looks like. It should look something like this:

If you wanted to leave it here, you definitely could! It looks a bit better than the default. If you want to improve it even more though, keep following along!

Step 3: Configuring .bash_profile

Over the next few steps, we’ll be creating some dotfiles to configure our Terminal experience. To edit these files, we’ll just be using the nano editor as we only need to add and save a few lines. Feel free to use vim, emacs, or whatever editor you’re most comfortable with!

Starting out, let’s set up our .bash_profile file. This is the first file that is read and executed when you open up your Terminal, so it’s important!

Let’s make sure we’re in the home directory. In your Terminal, run the command:

cd ~

To create your .bash_profile file, run the command:

touch .bash_profile

To edit your file, run the command:

nano .bash_profile

The nano editor should open with your new .bash_profile file. You could add all the configuration information in this file if you wanted, but I like to split it up for better maintainability. So, all we’re going to use our .bash_profile for is to source the other dotfiles.

With the nano editor open, add these lines:

source ~/.bash_prompt
source ~/.aliases

That’s it! To save, simply press Ctrl+X, then Y, then the Return key, then apply your changes with the command . .bash_profile.

Step 4: Configuring .bash_prompt

Our .bash_prompt file is going to contain the commands to set a custom bash prompt. This is definitely a personal preference, so make sure to customize it to your liking!

First, create your .bash_prompt file:

touch .bash_prompt

Now open up the file in the nano editor:

nano .bash_prompt

The layout I like for my prompt is — name directory (git-branch) >> |

First, let’s put a shebang at the top of our file so our system knows it’s bash. Add this line to the top of your file:

#!/usr/bin/env bash

Now, we’re going to want to make sure colours are enabled so our prompt looks nice! Add these 2 lines to do that:

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

CLICOLOR turns colours on, and LSCOLORS customizes them.

Let’s start setting up our prompt.There are a few different prompts you can customize, but we’ll stick to PS1 for this tutorial. PS1 is the primary prompt displayed in the Terminal before each command. Let’s just add our username for now. Add this line to your .bash_prompt file:

PS1="\[\e[0;93m\]\u\[\e[m\]" # username

The syntax might seem a bit weird, but it’s interesting to learn about if you’re curious! Basically, we’re getting the current username with \u, wrapping that in a specific colour, 0;93m, and adding in the proper escape sequences.
Let’s export that and see what it looks like.
Add this under your PS1 line:

export PS1;

Remember, to exit and save your file, press Ctrl+X, then Y, then the Return key. To apply your changes, simply execute the command . .bash_prompt.

At this point, your Terminal should look something like this:

Not bad but there’s plenty of room for improvement! Let’s build out the rest of the prompt.

Having every individual prompt element on it’s own line helps with maintainability, so let’s stick to that. We’ll add in a space first. Right after your PS1=#name line, add in a line for a space:

PS1+=" "    # space

Add in another line for the current directory and make it magenta:

PS1+="\[\e[0;95m\]\W\[\e[m\]"    # current directory

Add in a space and the >> characters to finish our prompt:

#PS1+=" "      # space
#PS1+=">> " # end prompt

Make sure your export PS1; line comes after all that. Save your file, exit, and apply your changes. If you wanted to leave here, you’d have a pretty nice looking prompt!

However, if you’re like me and often working in a git repository, it’s nice to have your current branch displayed in your prompt. Above your PS1 configuration, we’ll add in a little function to get the current working branch.
There are plenty of ways to achieve this, but this works for me:

git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

Let’s add that into our prompt configuration right after the #current directory line. I’m going to set mine to be green:

PS1+="\[\e[0;92m\]\$(git_branch)\[\e[m\]".   # current branch

Your entire .bash_prompt file should now look something like this:

#!/usr/bin/env bash

git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
PS1="\[\e[0;93m\]\u\[\e[m\]" # username
PS1+=" " # space
PS1+="\[\e[0;95m\]\W\[\e[m\]" # current directory
PS1+="\[\e[0;92m\]\$(git_branch)\[\e[m\]" # current branch
PS1+=" " # space
PS1+=">> " # end prompt
export PS1;
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

Save, exit, and reapply changes. You won’t notice anything immediately, but if you navigate to a git repository, your prompt should be finished and look something like this:

Step 5: Configuring .aliases

Now that our prompt is all set up, let’s make our Terminal experience a little better. We’re going to set up some useful aliases, which are just shortcuts for commands. These are the aliases I like to use, but you can set anything you can think of. If there are common commands you find yourself using, setup an alias for them!

Open up your .aliases file:

nano .aliases

Add in a shebang:

#!/usr/bin/env bash

I’ll just list out some basic aliases that I use. There are plenty of great examples online, so make sure to do a little searching.

alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias dc="cd ~/Documents"
alias p="cd ~/Documents/projects"
alias home="cd ~"
alias g="git"
alias gs="git status"
alias gd="git diff"
alias gb="git branch"
alias gm="git checkout master"
alias showhidden="defaults write AppleShowAllFiles -bool true && killall Finder
alias hidehidden="defaults write AppleShowAllFiles -bool false && killall Finder
alias hidedesktop="defaults write CreateDesktop -bool false && killall Finder
alias showdesktop="defaults write CreateDesktop -bool true && killall Finder

Save, exit, and reapply your changes. Now you can simply type in any of those aliases and the corresponding command will execute!

If you’re going to be doing a lot of dotfile editing like we are, set some aliases like this:

alias aliases="nano ~/.aliases && . ~/.aliases"
alias bashprofile="nano ~/.bash_profile && . ~/.bash_profile"

Save, exit, and reapply your changes. Now all you have to do to edit those files is type the alias command aliases or bashprofile. It’ll open up your files, and automatically apply the changes once you save and exit!

Step 6: Cleaning Up

You may notice you get an annoying Last login: message when opening up your Terminal window.

To get rid of that, all you need to do is add in a file. Still in your home directory, simply run the command:

touch .hushlogin

That should clean it up for you!

That’s it! You should have a much better Terminal experience now. Make sure to customize everything to your liking, as that’s the best way to learn! My files are always a work in progress and yours should be too. If you’re interested in seeing my other dotfiles, feel free to check out my git repository: