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_prompt
Code 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 FUNCTIONS git_branch() { git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } # TERMINAL PROMPT 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
Code language: PHP (php)

Configuring .aliases

I had to create my .aliases too:

touch .aliases
Code language: CSS (css)

And here’s my file:

# NAVIGATION alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." # COMMON DIRECTORIES alias dl="cd ~/Downloads" # alias dt="cd ~/Desktop" alias dc="cd ~/Documents" # alias p="cd ~/Documents/projects" # alias home="cd ~" # GIT alias g="git" alias gs="git status" alias gd="git diff" alias gb="git branch" alias gm="git checkout master" # SHOW/HIDE HIDDEN FILES #alias showhidden="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder #alias hidehidden="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder # SHOW/HIDE DESKTOP ICONS #alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder #alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder # CUSTOM CHANGES 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.

Sources:

Tags: bash mac terminal