Customizing my macOS Terminal

On April 24th, 2021 in Myself, Tech

MacOS Terminal is ugly and not very functional. I have one always open, so I decided to make it look better. I used some tips from a Medium post (How To Customize Your macOS Terminal).

Setting the Theme

I’ve been using a theme called Homebrew for the last months, but I wasn’t satisfied with it, so I decided to take a look on the recommended theme “atom-one-dark-terminal“. I imported it and I liked it.

Setting preferences

On the same Terminal Preference Window, set those settings.

Text Tab
* Font: Menlo Regular 12 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

It’s almost the same as the Medium post suggested, my only change was the font size. I prefer it with 12pt.

Configuring .bash_profile

My .bash_profile was already set, but I decided to improve it and clean with the Medium suggestions.

# My .bash_profile

source ~/.bash_prompt
source ~/.aliases Code language: PHP (php)

Configuring .bash_prompt

I had to create the .bash_prompt:

touch .bash_promptCode language: CSS (css)

If you want to understand what to what, take a look in the Medium post. It’s well written and explained. I’m showing my complete .bash_prompt:

#!/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=ExFxBxDxCxegedabagacadCode language: PHP (php)

Configuring .aliases

I had to create my .aliases too:

touch .aliasesCode language: CSS (css)

And here’s my file:

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

alias ll="ls -alh"Code language: PHP (php)

Notice that I copied the Medium post file, but commented many of the lines. I also recreated one of my most used alias on this file (the “ll”).

After that, you just need to reopen Terminal and it’ll be working with the new tweaks.


Tags: bash mac terminal