Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)





How to install


brew cask install iterm2

Or, if you do not have homebrew (you should ;)): Download and install iTerm2

iTerm2 has better color fidelity than the built in Terminal, so your themes will look better.

Get the iTerm color settings

Just save it somewhere and open the file(s). The color settings will be imported into iTerm2. Apply them in iTerm through iTerm → preferences → profiles → colors → load presets. You can create a different profile other than Default if you wish to do so.

Oh My Zsh

More info here:

Install with curl

sh -c "$(curl -fsSL"

When the installation is done, edit ~/.zshrc and set ZSH_THEME="agnoster"


If you prefer the Powerlevel9k look with added info such as exit codes and timestamps on the right, run:

git clone ~/.oh-my-zsh/custom/themes/powerlevel9k

Then edit your ~/.zshrc and set ZSH_THEME="powerlevel9k/powerlevel9k".

Powerlevel9k offers a whole lot more, best is to check out these user made configs yourself.

Install a patched font

Open the downloaded font and press "Install Font".

Set this font in iTerm2 (14px is my personal preference) (iTerm → Preferences → Profiles → Text → Change Font).

Restart iTerm2 for all changes to take effect.

Visual Studio Code config

Installing a patched font will mess up the integrated terminal in VS Code unless you use the proper settings. You'll need to go to settings (CMD + ,) and add or edit the following values:

  • for Source Code Pro: "terminal.integrated.fontFamily": "Source Code Pro for Powerline"
  • for Meslo: "terminal.integrated.fontFamily": "Meslo LG M for Powerline"
  • for other fonts you'll need to check the font name in Font Book.

You can also set the fontsize e.g.: "terminal.integrated.fontSize": 14

Further tweaking

Things like

  • auto suggestions
  • word jumping with arrow keys / natural text editing
  • shorter prompt style
  • syntax highlighting

can be found in the section below.

Auto suggestions (for Oh My Zsh)

Auto suggestions

Just follow these steps:

If the auto suggestions do not appear to show, it could be a problem with your color scheme. Under "iTerm → Preferences → Colors tab", check the value of Black Bright, that is the color your auto suggestions will have. It will be displayed on top of the Background color. If there is not enough contrast between the two, you won't see the suggestions even if they're actually there..

Enable word jumps and word deletion, aka natural text selection

By default, word jumps (option + → or ←) and word deletions (option + backspace) do not work. To enable these, go to "iTerm → Preferences → Profiles → Keys → Load Preset... → Natural Text Editing → Boom! Head explodes"

Custom prompt styles

By default, your prompt will now show “user@hostname” in the prompt. This will make your prompt rather bloated. Optionally set DEFAULT_USER in ~/.zshrc to your regular username (these must match) to hide the “user@hostname” info when you’re logged in as yourself on your local machine. You can get your exact username value by executing whoami in the terminal.

For further customisation of your prompt, you can follow a great guide here:

Syntax highlighting

brew install zsh-syntax-highlighting

If you do not have or do not like homebrew, follow the installation instructions instead.

After installation through homebrew, add

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

to the end of your .zshrc file. After that, it's best to restart your terminal. Sourcing your ~/.zshrc does not seem to work well with this plugin.

naartjie commented Dec 5, 2014

Awesome 👍 thanks. Always wondered how the cool kids got their prompts looking like it was UI, with those arrows and blocks.

yev commented Apr 9, 2015

Very nice! Thank you, Kevin!

For the shorter prompt style you could use this for remote machines:

[[ -n "$SSH_CLIENT" ]] || export DEFAULT_USER="steve"

dritter commented Jun 2, 2015

Maybe you like a more advanced powerline-style theme like powerlevel9k.


kevin-smets commented Jun 7, 2015

Thanks for the comments, glad to help your terminals look better / have a bit more functionality :).
Thx for the tip @SteveClement, I'll need to test it out first, then I'll I add it to the instructions.

abea commented Sep 6, 2015

Thank you, sir. the official iTerms Solarized Dark link doesn't seem to be working, so this is clutch.

ding404 commented Sep 6, 2015

great thank you ! sir. I got DejaVu Sans Mono in my iTerm !

@abea It works fine. If you used vim or something similar to disrupt its indentation, it won't work. Happened with me also. Try saving it again with proper indentation(perhaps using sublime text) and no trailing spaces, and load it again.

nice job!

Excellent job with the theme colors. Looks great.

enrmarc commented Nov 21, 2015

Thanks Kevin! (Let's go Touch!)

orarnon commented Dec 8, 2015

Hey, I'm a newbie but I couldn't set the prompt right. I'm using: export DEFAULT_USER="my_user_name"
But the prompt remains the same. What am I missing? (Using OSx by the way)


kevin-smets commented Dec 8, 2015

Here's how my config looks like exactly (excerpt):

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.


So it's not declaring export or anything. After changing the value make sure to source your .zshrc

source ~/.zshrc

Or just quit and restart your iTerm to make sure your changes are picked up. Let me know if that works for you :).

nehero commented Dec 22, 2015

Really liking this theme.

Is there anyway to change the prompt to just the current working directory instead of the full string?

@kevin-smets I got it working, I just had to source my .zshrc. Thanks!

yzq1989 commented Jan 8, 2016


bkate commented Jan 13, 2016

thank you !!

skapil commented Jan 20, 2016

Thanks @kevin-smets. I got it working!

Great help

screenshot_mbpr_ 2016-01-27 um 18 23 32

This is how font size 14/14 looks like in my case! 14/18 and 18/24 isn't working, too!


kevin-smets commented Jan 29, 2016

@Ourelius are you using another terminal or something? The colors seem to be rather off as well..


kevin-smets commented Jan 29, 2016

@nehero if you just do echo $PROMPT you can see the default construction of the PROMPT variable in Zsh. You can overwrite this in your .zshrc of course, a great tutorial on that can be found @ tuts+

BelfordZ commented Feb 1, 2016

looks great, but instead of mapping option+arrows, why not in profile -> keys just map left option to be Meta?

That way, all the nice stuff still works (option + b === option + <-)


kevin-smets commented Feb 3, 2016

@BelfordZ, that did not work for me, no matter what combination. The only consistent solution I found is the one I added to the readme. That and you get a warning when switching to meta. Any improvements are always welcome of course, but I cannot seem to confirm this is actually a better change I'm afraid.

@BelfordZ, @kevin-smets, both variants does not work for me :/
Any idea why?

DONSA commented Feb 25, 2016

It's possible to style the numbers on the left?
A different background would be nice.

screen shot 2016-02-25 at 23 49 40


kevin-smets commented Feb 26, 2016

@DONSA it's all built into the iTerm colors setting (preferences -> profiles -> colors). You can easily change any color by hand, or by importing another theme altogether; you can take a pick from these:

E.g. changing the background is done simply by clicking the color next to "Basic colors - Background" and picking another color, but you can easily get a theme that is inconsistent this way.

@vuhrmeister, I have not found any other way to enable this sadly...

DONSA commented Feb 26, 2016

I mean, a different background only on Vim line numbers.

Great write up!!

Also make sure you don't use Apple's version of git ... it DOES not play nice with oh-my-zsh.

What is your color set for the Linux commands?

LmKupke commented Mar 3, 2016

@kevin-smets Love the theme. How do you make the Linux commands a different color?

How to remove the red marked part ?

You need to set DEFAULT_USER with your username (niamulhasan) in your .zshrc file
To do so, run this command:

echo "DEFAULT_USER=\"niamulhasan\"" >> ~/.zshrc && source ~/.zshrc

You're done :)

lucid instructions which made it easy. Thanks a ton.

@niamulrox you also have to override prompt_context (source)

echo "prompt_context () { }" >> ~/.zshrc && source ~/.zshrc

Also if you didn't already override the DEFAULT_USER as mentioned before:

echo "DEFAULT_USER=\"\"" >> ~/.zshrc && source ~/.zshrc

How did you get the syntax highlighting for: cd, touch etc. to work?


kevin-smets commented Apr 14, 2016

@joakim5937x sadly I did not, so that's a good remark :). The screenshot is not mine, I should update it to reflect the actual result more closely. Sorry for the false promise :D.

Hi, how did short path name like this
2016-04-21 16 13 31

The word jumps don't seem to work, just outputs [C or [D

Angekap commented May 19, 2016

@kevin-smets while I'm getting this to work, whenever I exit and re-open iTerm, the changes revert to their original state.
I've changed the DEFAULT_USER, and sourced the ~/.zshrc....but this does not remember my settings :(

@kevin-smets Did you mean to put quotes around agnoster? It only worked after I removed the quotes.


kevin-smets commented May 29, 2016

@nickam992 indeed, there are double quotes around my entry, without issues. Glad you got it working :).

The word jump settings don't seem to work all too well for everyone, tried out another method and added this to the gist.

Ping @evoactivity & @vuhrmeister


kevin-smets commented May 29, 2016

@joakim5937x I added syntax highlighting :)

ermand commented Jun 9, 2016

Thanks @kevin-smets for these instructions :)

I get this LOL :(

screen shot 2016-06-13 at 7 31 27 pm

I've the same problem as @ORESoftware. Yesterday it was fine, today it appears it is ignoring the font setting.

@petrillek @ORESoftware Looks like you haven't install powerline font in iTerm

roma86 commented Jun 18, 2016

@khadorkin, hello. What do you mean haven't install fonts in iTerm?

I followed instructions in this topic.


iTerm2 settings

Font Book

All fonts from installign through

iTerm restarted multiple times. Mac os restarted twice.

@roma86, I use the font Meslo LG M DZ for Powerline and it works.
You may try the Menlo font provide from Powerline shown the second line of the pic below.

I encounter a issue of the prompt.
My triangle color is white. Is someone can help me to solve this?
I use iTerm2 v3.0.2
Many thanks.


kevin-smets commented Jun 20, 2016

@roma86 you need to use a powerline font, otherwise it won't work. The regular Menlo will not suffice.

@petertom51 I use the exact same version, not sure where your problem is coming from. Have you tried using another theme? The only diff I see is that anti-aliasing in your prefs is disabled, that should not matter though but you never know, maybe toggling that could make a difference.

/edit just saw, the other text in your prompt is white as well.. Did you define other colors anywhere but the default?


First, thanks for this amazing work !!!
Secondly, there is a way to have specific color for the directories ?


Very nice, thanks.

terle commented Jun 30, 2016

God this is so nice. Thanks for sharing

AbhishekGhosh commented Jul 3, 2016

@petertom51 : I hope that you already got the fix. You will need to adjust Preferences > colors > minimum contrast, Preferences > colors > color boost, Preferences > colors > minimum contrast & Preferences > window > transparency to get all the colors. This can happen when display is not hardware calibrated and you need exact Solarized Dark color palate. Color palate was composed on calibrated machine. More you will decrease the transparency, the difference of colors will get vanished. You are using a minimum contrast of more than 50% -- text became white.

untitled 6

Arasthel commented Aug 3, 2016

@AbhishekGhosh @petertom51 I just wanted to add that the main problem I had with the duplicate color came from window transparency. This solved it for me: Preferences > Profiles > Window > Window Appearance > Keep background colors opaque.

poma commented Aug 9, 2016

Those arrows are a hell for perfectionist. This is as close as I was able to get to pixel perfect stacking. Menlo sizes 13/12. In most examples here corners are even worse.

screen-shot-2016-08-09-at-12 55 40

Thank you for this walk-through I love the look of this and will give it a run for a bit ;)

vonera commented Aug 11, 2016

nice work, thank you. but I've noticed one problem:
If the auto suggestions do not appear to show...
For Solarized Dark don't change the value of Black Bright as suggested above. This will affect the Solarized colorscheme in vim.
Instead, use ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE as described here. You can use any number between 0 and 255 (default is 8)
echo ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=\'fg=60\' >> $ZSH_CUSTOM/zsh-autosuggestions_custom.zsh

timwis commented Aug 14, 2016

This is great! Note the first time I went through this, I didn't realize you had to change the font in both places: the default font and also the font for non-ascii text. If you don't do that, the git symbols show up as question marks.

Is there any way to shorten the prompt, but only strip off the hostname?

So it would be nice to get this:

⚡ root > ~ > or pieterjan > ~ >

Thanks a lot Kevin! Really appreciate it :)

Hi Kevin!
Can not understand what's went wrong and what I need to do to fix it. Can you help me?

Image and video hosting by TinyPic

Wonderful tool, nice job Thanks

venkateshk commented Sep 14, 2016

Hi All, I am seeing a weird symbol at the beginning of my prompt which doesn't go away with any of the themes. I see it only with iterm2 but not other terminal apps. Can someone please help me to get rid of it. I even tried resetting iTerm2 but no luck.

screen shot 2016-09-13 at 6 57 14 pm

screen shot 2016-09-13 at 7 04 13 pm

marines commented Sep 19, 2016

@venkateshk it's iTerm's feature.

Thanks @kevin-smets! This gist should be part of zsh wiki.
I chose a different color scheme - Neutron. Just wanted to share it here.

screen shot 2016-10-03 at 1 03 44 am

@venkateshk There should be line like source "${HOME}/.iterm2_shell_integration.zsh" in your .zshrc, removing that line can resolve your problem.

todofixthis commented Oct 4, 2016

Most comprehensive guide to setting up iTerm2 key mappings that I've seen so far:

Uses ASCII control codes to perform certain actions universally (no more having to synchronize .inputrc, .vimrc, etc.).

Nice supplement to the Word Jumps section in the gist, and should address some of the issues other commenters have run into.

I am only getting a single color (default: Violet) for the arrows. How can I change its color?

But everything works fine for git folders with no uncommited changes in them. If folder contains something modified, then the circle is shown, like that:

What should I do to fix that?


kevin-smets commented Oct 15, 2016

This is not a bug, this means you have changes which are not staged for a commit. Running git add . will turn the circle into a plus sign. Every symbol has its meaning.

i want to use this Meslo font in my linux. How about the license? Is it free?

I want use Terminal ( not iTerm) is there any guideline to install this theme?

@PieterxJan Override prompt_context in your .zshrc file as follows to show only username (without machine name)

prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"

liutf commented Nov 5, 2016

very nice ! tkx!

ibihim commented Nov 10, 2016

This is awesome, but does someone know how to add the time to the right side and start the prompt on a new line?
I would love to merge agnoster's left part and bureau's right part 😄

poctek commented Dec 31, 2016

Finally found how to remove the machine name from the prompt, thank you!

nimmividya commented Jan 1, 2017

Wow! Thanks a lot. Now I can enjoy working with git.

How to make my PROMP to show only the folder name, not the directory path:
screen shot 2017-01-03 at 12 36 43 pm

When I call echo $PROMPT it shows me:



wendingp commented Jan 4, 2017

Where can I find the Colors Tab in iTerm?


kevin-smets commented Jan 9, 2017

@luc815689327 you can get there by going to preferences -> profiles -> colors

oychao commented Jan 10, 2017

Mark & stared

This is fantastic. Thank you! Straight to starred

How to make my PROMPT to only show the current directory instead of long directory path name ?


kevin-smets commented Jan 19, 2017

For my setup I had to git clone powerlevel9k to a different directory:
git clone ~/.oh-my-zsh/themes/powerlevel9k

dritter commented Jan 19, 2017

@shankarregmi if you use powerlevel9k, you could set POWERLEVEL9K_SHORTEN_DIR_LENGTH=1. That shortens your path to the last directory.

The strength of powerlevel9k is its flexibility. Have a look at what others build with it.


kevin-smets commented Jan 20, 2017

@dritter, thanks for that!

Thanks @dritter, I have my awesome looking iTerm2
Thank you @kevin-smets

franklinyu commented Feb 7, 2017

I met an issue when using iTerm2 with theme "agnoster". My "tab completion" will shift the entire line left by a character:


Within Git repository this gets even worse:


This issue doesn't appear in It only happens if it can't decide the completion and show all the possibilities; everything is fine when there is only one completion choice (and Zsh follows the choice).


Problem solved by unckeck "Preferences -> Profiles -> Text -> Unicode -> Treat ambiguous-width characters as double width (not recommended)." I must have been drunk to check this checkbox.

atajwala commented Feb 7, 2017

EDIT: Found the root-cause. Solarized dark theme was not displaying gray correctly. More info if interested - mochajs/mocha#802

First off - fantastic scheme! Thanks much!
I am not seeing certain console output after setting this up. These outputs are not visible unless they are highlighted (see below):

screen shot 2017-02-07 at 11 11 14 am

after highlighting:
screen shot 2017-02-07 at 11 11 36 am

any idea what could be causing this?


kevin-smets commented Feb 10, 2017

@atajwala, it's an issue with the Solarized theme, a patched version can be found here:

I've made it the default one now. More info on the specific issue: mbadolato/iTerm2-Color-Schemes#62

//edit: missed the edit that mentioned you already fixed it dammit :)

How do I display icons ? Trying to get mac icon displayed, but it shows OSX
screen shot 2017-02-19 at 11 29 33 am

dritter commented Feb 23, 2017

@agnelantony2 Here is a tutorial for a pre-patched font:

  1. You need a compatible font
  2. Set the correct POWERLEVEL9K_MODE="awesome-patched" at the top of your ~/.zshrc
  3. Restart your shell (or source your ~/.zshrc)

shangxor commented Feb 28, 2017

There seems to be an issue with conda environments. From what I have seen in the powerlevel9k.zsh-theme file, there are functions defined for anaconda, virtualenv and pyenv.

I have modified the prompt_anaconda() and changed the path as follows:

This does not seem to work, and the conda env name does not get displayed at the beginning of the PROMPT.

Anyone has an idea how to fix this ?

dritter commented Mar 1, 2017

@shangxor Could you report that on the powerlevel9k bug tracker?

Not sure if this was touched on, as I can't find anything on this online. My zsh integration didn't work as I had expected. See the screenshot.

Any ideas?

screen shot 2017-03-04 at 11 43 10 pm


kevin-smets commented Mar 5, 2017

@sogeniusio that looks like you're not selected the powerline font as your terminal font. It needs to be a patched font, otherwise the symbols will show up, well.. like that :).

Hi guys,

might be a stupid question but did not find so far the answer.
How can I get colored folders when using ls, similar to ls -G ?
Thanks a lot

jlira2 commented Mar 8, 2017

This did not work for me. using MacOS sierra. installed iTerm2, got the color settings, installed Oh My Zsh, changed ~/.zshrc file to ZSH_THEME="agnoster" installed font, console changed colors and font but I did not get the colored arrows.

yes i did restart the console, command + Q and all.


I used this color scheme Solarized Dark theme (patched version to fix the bright black value), but looks different:

how can I fix it?

dritter commented Mar 18, 2017

@iamethicker you are searching for dircolors

@jlira2 did you select the newly installed font in the iTerm2 settings (profiles/text)?

can someone please help me remove this theme.

mitrx commented Apr 2, 2017

@poma, try Source Code Pro for Powerline, 14. It seems to be perfect:
screen shot 2017-04-03 at 02 25 36

mitrx commented Apr 3, 2017

As @vonera mentioned, if you want to fix colours of autosuggestions don't use the solarized dark theme presented here.
To achieve the same effect as that theme does you should set ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE to 'fg=10' in you .zshrc. Precisely, you should add
to your .zshrc.

hrafnkellpalsson commented Apr 5, 2017


kevin-smets commented Apr 13, 2017

Thanks for the suggestions and fixes @mitrx & @hrafnkellpalsson, I adjusted the readme to reflect them.

I installed everything and seems to work fine, however there is something I dislike and I do not manage to change. Everything looks very grey, when I do ls everything has the same color (I am used to see some rich colors with ubuntu normal bash), the prompt has the same colors than command outputs. I do not manage to add more rich colors, i tried with multiple themes and I always get one color for everything.

screen shot 2017-04-18 at 15 04 27

Also, is there a way to keep the theme, and setting when you ssh into another computer?

What are these numbers for, and how do I make use of them?

Thanks for the tutorial by the way, nicely written and liking this setup so far.

For the people asking about to show only the current path, do this:

  1. Open this directory ~/.oh-my-zsh/themes
  2. Open the agnoster.zsh-theme file with any text editor
  3. Go to the prompt_dir() function
  4. Replace the line in the function with this: prompt_segment blue black '%c'

Done. Now the theme only shows the current path.


kevin-smets commented May 3, 2017

@Antairez these are exit codes (the 127 in red) and the number of your command. This is built into powerlevel9k, check out how to configure it here:


Brilliant! Great job!

Purple90 commented May 24, 2017

I am having trouble getting this to work with iTerm. After I make the changes, the i just get blue boxes with '?' in it. Any suggestions?

edit: Solution is ->

Great script its working fine.

First of all, great theme! I love it!
But, how do I get some more space between the branch icon and branch name?



Awesome dude....

Thank you!, Nice and simple work

I made 75% of this working the day before by going around the sites and fiddling with keyboard.
This one the most cleanest one!!!

Thank You...

se-jaeger commented Aug 5, 2017

@kevin-smets you can improve the word jump section. See: If you want, feel free to use my revision:

Nevertheless very good job! Thank you.


kevin-smets commented Aug 7, 2017

@se-jaeger that thing is a game changer 👍 Thanks!

Thanks a lot for this. Cheers. 😄

@Antairez are you try to iterm2 > Preferences > Profile > Text > uncheck 'draw bold text in bright colors' ?

@frankgraave I have the same problem. Were you able to figure out what was causing the lack of spacing?

ekenigs commented Sep 15, 2017

If someone is using a terminal in VSCode and has an issue with a font. You can add this line to your VSCode config:

"terminal.integrated.fontFamily": "Meslo LG M for Powerline",

Changing this with iTerm changed my Terminal View (ctrl+alt+t) in Eclipse. It has all the strange colours and hardly visible. Anybody has a similar experience? I would like to get this view in Eclipse or return back to it default. Please let me know.

@ekenigs I've faced the same issue, but after adding
"terminal.integrated.fontFamily": "Meslo LG M for Powerline",
it still looks bad -
any ideas how it can be fixed?

Wow, thank you!

cxrod commented Nov 15, 2017

@mikesilence @HristoEftimov
just add POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 to your .zshrc

marcko commented Nov 19, 2017

Nice, Thank you !!

Thanks for the excellent guide!

matisnape commented Dec 13, 2017

@ekenigs I have the same issue as @kagarlickij - could someone help? iTerm works fine.

LiuZhiyan commented Jan 23, 2018

Hi guys, why I have "⍟3" suffix in the prompt, how can I remove/fix it? Any idea? Thanks a lot.


Thanks man, you're the best

stevehealy commented Feb 8, 2018

Having problems installing the Meslo font on Mac (High-Sierra). Any ideas?


EDIT: Installing the fonts using these instructions worked perfectly...

ekenigs commented Feb 12, 2018

@kagarlickij and @matisnape sorry but I don't know what could be the issue. I just did what I said and had no issues.

Cyhar commented Feb 14, 2018


If someone want to uninstall (please read before) :
thanks the author @robbyrussel ! (

PK85 commented Feb 18, 2018

Thanks Kevin :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment