How to install
brew install --cask 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
- Solarized Dark theme (patched version to fix the bright black value)
- Solarized Light theme
- More themes @ iterm2colorschemes
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: https://github.com/robbyrussell/oh-my-zsh
Install with curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
When the installation is done, edit
~/.zshrc and set
ZSH_THEME="agnoster" for the default look. Or better yet, go for Powerlevel10k.
Powerlevel9k / Powerlevel10k
Why Powerlevel10k? Well, because it's a drop-in replacement for Powerlevel9k, just a lot faster to render your prompt.
ls feels fast again!
So if you prefer the Powerlevel10k look with added info such as exit codes and timestamps on the right, run:
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
Then edit your
~/.zshrc and set
ZSH_THEME="powerlevel10k/powerlevel10k". Once you do so, when you start a new terminal session, the Powerlevel10 configure wizard will be launched to set your prompt, beware, there are many many options!
Powerlevel10k offers a whole lot more and is extremely configurable, best is to check its project page.
If you want to trigger the configuration wizard immediately, simply run
p10k configure to discover all options, which are plentiful.
Install a patched font
If you did not go with Powerlevel9k or you want another font, read on:
- Source Code Pro
- Source Code Pro + Font Awesome, this one is needed if you want the icons from Font Awesome as shown in the screenshot for Powerlevel10k.
- Others @ powerline fonts
Open the downloaded font and press "Install Font".
Set this font in iTerm2 (iTerm → Preferences → Profiles → Text → Font), in the dropdown select the desired Font. You will see it change on the fly.
Restart iTerm2 for all changes to take effect.
- auto suggestions
- word jumping with arrow keys / natural text editing
- shorter prompt style
- syntax highlighting
- visual studio code config
can be found in the section below.
Auto suggestions (for Oh My Zsh)
Just follow these steps: https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh
If the auto suggestions do not appear to show, it could be a problem with your color scheme. Under "iTerm → Preferences → Profiles → 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 → Presets... → 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. To remove this you can add the line
For further customisation of your prompt, you can follow a great guide here: https://code.tutsplus.com/tutorials/how-to-customize-your-command-prompt--net-24083
brew install zsh-syntax-highlighting
If you do not have or do not like homebrew, follow the installation instructions instead.
After installation, add the following line
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.
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 + Font Awesome:
"terminal.integrated.fontFamily": "'SourceCodePro+Powerline+Awesome Regular'". The single quotes are important! Restart VS Code after the config change.
- 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 right click on them on select "Show in Finder" to get the exact name.
You can also set the fontsize e.g.:
Here's how my config looks like exactly (excerpt):
So it's not declaring
Or just quit and restart your iTerm to make sure your changes are picked up. Let me know if that works for you :).
@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.
@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: https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/schemes.
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...
@roma86, I use the font
@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?
@petertom51 : I hope that you already got the fix. You will need to adjust
nice work, thank you. but I've noticed one problem:
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
Nice supplement to the Word Jumps section in the gist, and should address some of the issues other commenters have run into.
@shankarregmi you can customise it like this: https://code.tutsplus.com/tutorials/how-to-customize-your-command-prompt--net-24083. I'll add it to the readme.
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 Terminal.app. 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.
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!
any idea what could be causing this?
@atajwala, it's an issue with the Solarized theme, a patched version can be found here: https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/Solarized%20Dark%20-%20Patched.itermcolors
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 :)
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 ?
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.
As @vonera mentioned, if you want to fix colours of autosuggestions don't use the solarized dark theme presented here.
The link to the Meslo font is broken.
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.
Also, is there a way to keep the theme, and setting when you ssh into another computer?
For the people asking about to show only the current path, do this:
Done. Now the theme only shows the current path.
edit: Solution is -> https://gist.github.com/agnoster/3712874#gistcomment-2032070
@kevin-smets you can improve the word jump section. See: https://apple.stackexchange.com/a/293988 If you want, feel free to use my revision: https://gist.github.com/se-jaeger/bf2d8992ccee0eb9f954fe05442c8c7d
Nevertheless very good job! Thank you.
If someone want to uninstall (please read before) : https://github.com/robbyrussell/oh-my-zsh/blob/master/tools/uninstall.sh
Link to Source Code Pro is broken, I guess it should point to https://github.com/powerline/fonts/blob/master/SourceCodePro/Source%20Code%20Pro%20for%20Powerline.otf