Simple Tricks to Improve the Terminal Appearance in Mac OS X

Feb 5, 2013 - 56 Comments

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.

Improve the Terminal appearance in Mac OS X

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:
  • export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
    export CLICOLOR=1
    export LSCOLORS=ExFxBxDxCxegedabagacad
    alias ls='ls -GFh'

  • Hit Control+O to save, then Control+X to exit out of nano

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:

Improve the Terminal appearance

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”

Enable bold fonts and bright colors in Terminal

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:

Change ANSI colors in Terminal

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

Adjust the Terminals background and appearance

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.

Terminal window with background image in Mac OS X

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:

Better looking terminal in Mac OS X

Which is a bit more interesting to look at than this, right?

Command prompt

Have a useful bash prompt or some other customization tip? Let us know in the comments.

.

Related articles:

Posted by: William Pearson in Command Line, Tips & Tricks

56 Comments

» Comments RSS Feed

  1. JakuSK says:

    Could someone edit these appearance lines so that it would work in zsh (not bash) that is default in Catalina?

    Thank You very much!!!

    • a2k-hanlon says:

      For zsh, instead of putting these pieces of code in .bash_profile, put them in .zshrc

      These are the same:
      export CLICOLOR=1
      export LSCOLORS=ExFxBxDxCxegedabagacad

      For the prompt colouring, you can do the following, (from https://stackoverflow.com/a/2534676 ):
      PS1=”%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% “

  2. MacNoob says:

    Does anyone know why the terminal scrolling slows down when one uses a picture as the background?

    The scrolling get progressively worse when the terminal is is moved to a larger monitor.

    I don’t understand why this happens.

  3. Sander says:

    As a web developer I often multitask between the terminal and GUI. Bc of this I like to add some opacity to the foreground terminal window (personal taste but find where you can see what’s behind it without losing the ability to read the text) and a lot of opacity in background terminal windows (just enough to see what that terminal was doing). That way I can (for example) read what’s on a web page while executing in the terminal.

  4. Farbod says:

    that was awesome thanks !

  5. Timothy says:

    Two options for shortening/shortening more your command prompt.

    1. You can replace the \w with \W to show present working directory (as in folder) instead of full directory (as in folder) path from user.

    Change

    export PS1=”\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ ”

    To

    export PS1=”\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\W[\033[m\]\$ ”

    In addition still using the change above, if you don’t want your hostname and username always showing in your command prompt, remove the username and hostname parts (including the @).

    Change

    export PS1=”\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ ”

    To

    export PS1=”\[\033[33;1m\]\W\[\033[m\]\$ ”

    Definition of \w and \W

    \w : the current working directory, with $HOME abbreviated with a tilde
    \W : the basename of the current working directory, with $HOME abbreviated with a tilde

    For breakdown of what the full export PS1 value included in the article means, see Hoylen’s comment.

    For a fuller list of backslash-escaped special characters (it’s where I learned the \w \W method) and some tips: https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix

    Note: I don’t think these changes affect anything else besides color and content of prompt line, but I’m not an expert.

  6. Timothy says:

    Article instructions for the first part ” Modify Bash Prompt, Enable Colors, Improve ā€˜lsā€™ “worked for me as of 1/6/2019. (I didn’t go any further.)

    Also Hoylen’s comment on explaining what the meaning of the value for the export PS1 part was quite helpful in letting me further customize the color of the command line prompt (and understand it).

  7. Excellent, this really does brighten up a dull terminal. Works well on macOS Mojave.

  8. Kenji says:

    How do I change the color of the username only? I.e. I want to change “Kenjis-KBP:~kenji$” only so that it stands out against whatever commands I type following it.

    I’m using macOS High Sierra (v. 10.13.6) terminal.

    Your help much appreciated!

    Thanks,
    K

  9. Andras says:

    Thanks for the tip it works well.
    Brings the usefulness of linux terminals to macOS.

    Just one more thing if it’s possible – how do I get ‘ls’ to display directories first [then executables] then the rest of the files?

    is there a
    –group-directories-first switch I could enable somehow?
    Thanks

  10. Roshan says:

    I followed the steps mentioned above to change the command line color,

    but it gives an error as below.

    -bash: alias: Setting: not found
    -bash: alias: PATH: not found
    -bash: alias: for: not found
    -bash: alias: Python: not found
    -bash: alias: 3.6: not found
    roshan@Roshans-MacBook-Pro:~$ ls
    ls: illegal option — #
    usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file …]
    roshan@Roshans-MacBook-Pro:~$

  11. SG says:

    Two things this tutorial didn’t make clear that took me a long time to figure out:

    1. Between “ctrl o” to save and “ctrl x” to exit nano, you MUST hit enter.

    2. For your text color changes to still be the same when you open a new Terminal window, you MUST type: “source .bash_profile”.

    Using OS X High Sierra.

  12. Gahas says:

    what is the difference between .bash_profile and .profile?

  13. Emily says:

    Hi I changed the colors in my terminal but now I dont want colors anymore what should I do?

  14. Ernie says:

    I changed my prompt, by copy/paste the above four lines into .bash_profile. Sometimes my prompt turns into this:

    Ernie@unknownd8a25e91fdda:~$”

    I expect this format: ā€œusername@hostname:cwd $

    Any ideas how I can fix it or where I can look to find the problem?

    Thanks,
    Ernie

  15. Idan says:

    How can I change “prompt” color with this solution?
    Currently it shows in black color.

    http://s22.postimg.org/cu9aid481/Screen_Shot_2016_02_05_at_21_14_51.png

    • Paul says:

      idan, you are looking to change the actual ANSI colors in use by Terminal application. I do this as well for certain color profiles because without doing so, certain things can be difficult to read with low contrast.

      The specific ANSI colors used can be set in the Terminal app preferences, go to Terminal > Preferences > Profiles > Text, then select the profile you are using, and adjust the “ANSI colors” section as you see fit. This screen shot may be helpful to refer to:

      https://cdn.osxdaily.com/wp-content/uploads/2016/02/change-ansi-colors-terminal-mac.jpg

      In this case you are looking to change the black ANSI color for a specific profile to something with a bit more contrast, maybe a shade of grey will do or similar.

      Hope that helps!

  16. fr33kill says:

    How will I change the colour of my command lines?

    $ git init

    I want git init to be of different colour. Is that possible?

  17. Andrea says:

    Can I change profile’s settings as text color and background of terminal by command line?

  18. phoenix6142 says:

    Thank you very much. Worked like a charm. Great article!

  19. Daniel says:

    Can I affect the same changes in Ubuntu?

  20. Ajinkya says:

    Thanks, this even works for Yosemite :D

  21. thupker says:

    you can creat .profile as new file and paste what given above and it’s working perfectly fine

  22. Icebox says:

    Thanks for this. Learn something new every day on my MacBook Pro. Too bad we couldn’t have these UI choices in Yosemite preferences.

  23. elias says:

    I keep trying these steps (plus similar posts, promoting the same colour options)..most people seem to be able to pull this off successfully..Control+X to save changes & code terminal window..never seems to work..oh wells
    got some colours going but nothing as shmcik as those above..
    osx 10.9.5

    • michael says:

      @elias Try control+O to save changes, hit , then control+X. Open a new terminal window, and your changes should be there

    • thupker says:

      try to open in vim editor and that is easy to save just enter esc and type :wq that will work
      and you must need to open as admin typing sudo

  24. Sn says:

    could chnage the terminal from humm to aahh. Thanks!

  25. Jinx says:

    I pasted in the color settings just as described in this article, and now every time I log in I see this:

    -bash: alias: -: not found
    -bash: alias: See: not found
    -bash: alias: more: not found
    -bash: alias: at:: not found
    -bash: alias: https://osxdaily.com/2013/02/05/improve-terminal-appearance-mac-os-x/#sthash.tKyckXI0.dpuf: not found

    Any ideas how I can get rid of this?

  26. Andrew Rich says:

    Thanks for this article and useful comments! I put these into my ~/.profile – why would I use ~/.bash_profile instead?

    export PS1=”\[33[36m\]\u\[33[m\]@\[33[32m\]\h:\[33[33;1m\]\w\[33[m\]\$ ”
    export CLICOLOR=1
    export LSCOLORS=ExFxBxDxCxegedabagacad
    alias ls=ls\ -AFGhl
    export HISTIGNORE=”$HISTIGNORE:fortune:history”
    export HISTCONTROL=”ignoredups”
    export HISTTIMEFORMAT=”%F %T > ”
    export GREP_OPTIONS=”–color=auto”
    export GREP_COLOR=”1;32″

  27. giuseppe says:

    how to revert to the original ?

  28. Arpit says:

    How about switching to zsh? :)

  29. Andrew says:

    export HISTSIZE=5000
    export HISTFILESIZE=5000
    export HISTCONTROL=ignoredups
    export HISTTIMEFORMAT=’%F %T > ‘

    export GREP_COLOR=’1;32’

  30. Daniel says:

    What exactly are the “command line colors” enabled by CLICOLOR?

  31. tito says:

    LOLO, do you really think the first screenshot is an improvement ? Or is the improvement visible after wearing sunglasses ?

  32. Frizlab says:

    @Maicon Nunes
    I use Terminal everyday professionally and wouldn’t switch to anything else for all the gold of the worldā€¦
    You may prefer iTerm2, but let others have their own opinion.

  33. jon says:

    Ever since I discovered the free Source Code Pro font, I’ve never used anything else for all my Terminal & plain text work.

    And the colors are pretty & convenient, but I prefer to go all green-on-black. Guess I’m just pining for my old Apple II+.

  34. Maicon Nunes says:

    The best tip is get rid of Terminal.app and use iTerm2. Anyone who uses shell professionally will tell you the same.

    • Frizlab says:

      I use Terminal everyday professionally and wouldnā€™t switch to anything else for all the gold of the worldā€¦
      You may prefer iTerm2, but let others have their own opinion.

    • Andrew says:

      I also feel no need to try iTerm2 now that Terminal.app has tabs.

    • fnordius says:

      iTerm2 is all right, but it does have some quirks that I personally find to be deal breakers. Apple’s own terminal does the trick for me. A little tweaking of the bash profile is the only really important part, as I also use the terminal built into IntellijIDEA/PHPStorm.

  35. Hoylen says:

    To change the colors in the PS1 prompt, change the text between the “\[033[” and the “m\]”. Nothing means reset to default; number means that color; number followed by “;1” means the bright or bold version of that color.

    31 – red
    32 – green
    33 – yellow
    34 – blue
    35 – magenta
    36 – cyan
    37 – white

    For example, “\[33[34;1m\]” is bold/bright blue.

    The special values (e.g. \u for the username, \h for the hostname, \w for the current working directory) are documented in the “PROMPTING” section of the bash man page.

    Don’t like the actual colors displayed (e.g. blue is hard to read on a black background)? Change them in Terminal’s preferences (under Settings and the profile being used.)

    • Timothy says:

      Thanks Hoylen, this is what I was looking for — quite helpful knowing what this part means if you at all want to customize the command prompt more.

  36. sudocvu says:

    Why not use iTerm2 and oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh)

  37. Dan says:

    This is one of your own, from 3 October 2011, and a favorite of mine:

    “If you want to customize the Terminals appearance a bit beyond the prompt and a custom background, you can make the Terminal much more readable by using this nice trick to add a separator and timestamp between each executed command. This also bolds the current command text and anything that is available from tab completion.”

    https://osxdaily.com/2011/10/03/add-a-separator-time-stamp-between-terminal-commands-to-increase-readability/

  38. koraz says:

    @John
    What do you mean ? Because it does work in nano.

  39. John Robinson says:

    Control+X does not work in my Mountain Lion? Got any other suggestions.

  40. Leo M. says:

    In addition, there’s a nice LSCOLORS generator if you’d like to tweak.. it’s probably one of many on the ‘net:

    http://geoff.greer.fm/lscolors/

    Just use the ‘BSD colors’ and you’re set

  41. koraz says:

    Thanks, it’s indeed better than the default one. Colors is a must for terminal users. Thank you !

  42. John Robinson says:

    Control-X does not work in Mountain Line Terminal. Also using the arrow keys did not work in the terminal window.

  43. parakeet says:

    Text makes a big impact. I like Monaco as a font, anti-alias is a must, and use Command+ and Command- to change the font size on the fly depending on how much space you need.

    And don’t forget to use Full Screen Terminal if you really need to focus.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site