Simple Tricks to Improve the Terminal Appearance in Mac OS X
The standard terminal appearance is just boring old black text on a white background. Apple included a few nice preset themes too, but to really make your terminals appearance stand out you’ll want to take the time to customize it yourself. While some of these tweaks are admittedly pure eye candy, others genuinely improve the command line experience and make using the terminal not only more attractive but easier to scan.
Follow along and try them all, or just pick and choose which makes the most sense for you.
Modify Bash Prompt, Enable Colors, Improve ‘ls’
At a bare minimum, let’s get a better bash prompt, improve the output of the frequently used ls command, and enable colors. This is all done by editing the .bash_profile or .bashrc located in the home directory, for the purpose of this walkthrough we’ll use .bash_profile:
- Open Terminal and type nano .bash_profile
- Paste in the following lines:
- Hit Control+O to save, then Control+X to exit out of nano
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
alias ls='ls -GFh'
The first line changes the bash prompt to be colorized, and rearranges the prompt to be “username@hostname:cwd $”
The next two lines enable command line colors, and define colors for the ‘ls’ command
Finally, we alias ls to include a few flags by default. -G colorizes output, -h makes sizes human readable, and -F throws a / after a directory, * after an executable, and a @ after a symlink, making it easier to quickly identify things in directory listings.
Pasted in properly, it should look like this:
Open a new terminal window, run ls, and see the difference. Still not satisfied with the appearance, or have you already done that? There’s more to do.
Enable Bold Fonts, ANSI Colors, & Bright Colors
This will be theme and profile dependent, meaning you will have to adjust this for each theme. Most themes have ANSI color on by default, but enable it if it’s not.
- Pull down the Terminal menu and choose “Preferences”, then click the “Settings” tab
- Choose your profile/theme from the left side list, then under the “Text” tab check the boxes for “Use bold fonts” and “Use bright colors for bold text”
This makes things like directories and executables be bold and brighter, making them easier to spot in listings.
Consider Customizing ANSI Colors
Going further with ANSI colors, if you discover that certain text contrast or text colors are hard to read with a specific profile or against a specific background color in Terminal, you may want to manually adjust the ANSI colors used by Terminal app, this is done through the Preferences > Profiles > Text section:
Generally it’s best to adjust ANSI colors to be near their intended color mark but in the realm of being easier to read, a shade of grey to replace black for example.
Adjust Background Opacity, Blur, & Background Image
After you have colorization squared away, adjusting the terminals background appearance is a nice touch:
- Back in Terminal Preferences, choose the theme from the left side, then go to the “Window” tab
- Click on “Color & Effects” to adjust the background color, opacity, and blur – opacity at 80% or so and blur at 100% is pleasant on the eyes
- Click on “Image” to select a background picture. Dark background pictures are better for dark themes, light for light, etc
Opacity and blur alone tend to be enough, but going the extra step to set a background picture can look either really nice or completely garish. You make the call.
Install a Theme
Another approach is to use Terminal themes like IR Black, which are simple to install, add custom colors, and make the command line much more attractive. Here are three popular themes:
You can also easily create your own by spending some time with Terminal Preferences and setting colors and fonts to what you like.
New Terminal vs Old Terminal
Put it all together, and you should have something like this:
Which is a bit more interesting to look at than this, right?
Have a useful bash prompt or some other customization tip? Let us know in the comments.