In my workflow v3 screencast last week I gave a flash of my terminal, and (as I did when I saw it first), many people asked me about my set up.

![Remy Sharp’s terminal settings](/images/terminal.png)

[I’ve published 38 videos for new developers, designers, UX, UI, product owners and anyone who needs to conquer the command line today.](https://training.leftlogic.com/buy/terminal/cli2?coupon=BLOG\&utm_source=blog\&utm_medium=banner\&utm_campaign=remysharp-discount)

Terminal application tweaks[](#terminal-application-tweaks)

If you’re running a Mac, and you’re using Terminal, stop it. Right now. Just close it, remove the shortcuts and do yourself a favour, and install [iTerm 2](http://www.iterm2.com/). Future you will thank both you and me.

Here are the customisations:

Note that I’ve also sometimes tweak the "Minimum contrast" to around 1/5th on the slider in iTerm, this is to get around some dark colours used in Grunt and Yeoman (though may have been long resolved).

Shell tweaks[](#shell-tweaks)

Like I said, I’m using the Agnoster theme with a few small tweaks.

Firstly here’s my [complete theme file](https://gist.github.com/remy/6079223#file-remy-zsh-theme). One key difference is that I put the cursor on a line by itself so I don’t have to change where I’m looking to find my cursor.

This makes use of a battery capacity script [from stevelosh.com’s blog](http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/) (a good overall read too) with a small tweak (I use rectangles): [batcharge.py](https://gist.github.com/remy/6079223#file-batcharge-py).

Finally I have an online indicator, green for active connection, and red for not. I found that when I travel with a 3G dongle attached, it was useful to get a glance status. It’s done by a cronjob touching or removing a file to indicate status every minute, and the file is checked by the prompt: [online-check.sh](https://gist.github.com/remy/6079223#file-online-check-sh).

Published 25-Jul 2013 under #code & #development & #unix. [Edit this post](https://github.com/remy/remysharp.com/blob/main/public/blog/my-terminal-setup.md)

👍 2 likes

Comments

Lock Thread

Login

Add Comment[M ↓   Markdown]()

[Upvotes]()[Newest]()[Oldest]()

![](<https://download.remysharp.com/comments/avatars/Peter Kupfer.jpg>)

Peter Kupfer

0 points

8 years ago

How you install you theme on OSX…​ I tried it but it will not work…​.

![](<https://download.remysharp.com/comments/avatars/Chris Breault.jpg>)

Chris Breault

0 points

8 years ago

Is this compatible with iterm2’s shell integration? It seems I’m unable to use the shell integration feature with zsh installed.

![](<https://download.remysharp.com/comments/avatars/Nate Gardner.jpg>)

Nate Gardner

0 points

9 years ago

I’m having a bit of an issue with my RPROMPT. I know that this has happened to some other people also, but I am yet to find a fix. Simply, the battery indicator takes up two lines and the strings for colors are appearing. I added something to my RPROMPT as a temporary fix which puts the cursor one line below, allowing me to at least read what I’m typing since it overlays the bottom half of the battery output otherwise. Additionally, both the network indicator and the batcharge appear to be always yellow.

This is the output from batcharge: \[31m◼◼◼◼◻◻◻◻◻◻\[00m

Any idea where I might be able to solve this?

![](<https://download.remysharp.com/comments/avatars/Nate Gardner.jpg>)

Nate Gardner

0 points

9 years ago

I solved this problem.

I had to edit batcharge color definitions. By editing the colors in [batcharge.py](http://batcharge.py) to the following, I got it working. However, after doing the same thing to the online indicator, it still does not appear to change color, which is strange.\ color\_green = '\e\[00;32m'\ color\_yellow = '\e\[00;33m'\ color\_red = '\e\[00;31m'\ color\_reset = '\e\[00;00m'

Now, the battery indicator is too far from the right side. I’m not sure how to move it to hug the right end of my terminal more closely.

![](<https://download.remysharp.com/comments/avatars/Filip Bartuzi.jpg>)

Filip Bartuzi

0 points

9 years ago

How did you change cursor colour?

rem

0 points

9 years ago

iTerm, preferences, profiles, colours, basic colours, then set the cursor colour as you please.

?

Anonymous

0 points

10 years ago

Thanks for this @remy — having an issue though in the battery colors and getting the proper symbols to display in the prompt for 'dirty' git repo.

Also for whatever reason my cursor sits on the prompt not next to it.

Any ideas what I missed — I read through all the comments and can’t see what I missed.

?

Anonymous

0 points

10 years ago

@Darren\ I had the same issue and I couldn’t sleep for 2 nights without fix it :)\ Here is what I have done to get it work, and hope it helps you.

  • Check the permission. From terminal within ‘bin’ folder run ’ls -l’. For me I got:\ -rwxr-xr-x@ 1 ahmed staff 1161 30 Dec 12:56 [batcharge.py](http://batcharge.py)\ Which means I have the privilege to read, write and execute that file.

  • Using ‘chmod +rwx [batcharge.py](http://batcharge.py)’ changes the file mode and its permission.

  • I thought I’m done and ready to sleep, but now way I got a syntax error:

    File "/Users/ahmed/bin/[batcharge.py](http://batcharge.py)", line 25\
    SyntaxError: Non-ASCII character '\xe2' in file /Users/ahmed/bin/[batcharge.py](http://batcharge.py) on line 25, but no encoding declared; see [http://www.python.org/peps/...](http://www.python.org/peps/pep-0263.html) for details
  • Reading through the provided link I found I need to add ‘# coding=UTF-8’ as after ‘#!/usr/bin/env python’

After that it’s done and now I can sleep :)

?

Anonymous

0 points

10 years ago

Great post! I finally got the theme working but now I’m getting this:

battery\_charge:1: permission denied: /Users/Darren/bin/[batcharge.py](http://batcharge.py)

any idea what’s happening?

?

Anonymous

0 points

10 years ago

To get the Powerline symbols working, I ended up installing the Powerline Symbol font, opening it in FontBook and copying and pasting the icon into my theme file

?

Anonymous

0 points

10 years ago

I still cannot get the special character in SEGMENT\_SEPARATOR to show up. I have installed all the powerline fonts and set my non-ascii font to Source Code Pro for Powerline, Medium, 14pt. I have also set TextWrangler’s font to this and I see a character that looks like a square with a circle in it when viewing the theme code instead of the cool branched arrow. I also cannot find it when I look through the character map.

![](/images/no-user.svg)

Robin Layfield

0 points

10 years ago

SEPARATOR CHARACTER NOT RENDERING PROPERLY: SOLUTION

To get this to render properly, you need to install all 3 of the Powerline fonts in the gist that Remy references in line 9 of the theme:

It’s one of these that has the separator character in it and from what I can tell this character is unrelated to the font that you specify in your iterm profile.

HTH

Robin

?

Anonymous

0 points

10 years ago

Thanks for detailing this, Remy! I’d heard of zsh/oh-my-zsh but hadn’t felt inspired to check them out. The nice coloured prompt was really appealing. Having (finally) got it working, I am uncertain I’ve made the right choice for me.

Does zsh change the autocomplete actions at different parts of a command? In bash I could supply a path to a git command and have bash autocomplete the parts of the path I couldn’t remember or be bothered to type. Zsh (or the theme?) seems to turn off autocomplete for paths as arguments. That’s a significant hinderance to my productivity until I can work out how to change the behaviour.

?

Anonymous

0 points

10 years ago

Great tips…​

Would be interesting to see what shortcut functions you have under .zshrc

?

Anonymous

0 points

10 years ago

Thanks for the tip, Remy!

I took me a while it figure out I needed .oh-my-zsh to get themes working, but it’s up and running now.

?

Anonymous

0 points

10 years ago

Thanks so much Remy! This helped me lots in finally making the move to iTerm2.

?

Anonymous

0 points

10 years ago

oh.. that font.

?

Anonymous

0 points

10 years ago

so which font is the right non-ASCII font?

?

Anonymous

0 points

10 years ago

@remy just fixed! thanks to @gnachman! I didn’t set the right font for Non-ASCII font.

?

Anonymous

0 points

10 years ago

Of course now I figured it out, when setting the font in iTerm2 I was picking the font family, but failing to the select the one typeface. Doh.

?

Anonymous

0 points

10 years ago

I’m with @patrick91, got everything working except I can’t figure out how to get the cool arrow for the SEGMENT\_SEPARATOR, which is the coolest part! I installed the Powerline font, but I don’t see symbols in the font book…​

?

Anonymous

0 points

10 years ago

@Sarah, it looks like you’ve copied the whole file, but the first line must be #!/usr/bin/env python

(I made the same error) :)

?

Anonymous

0 points

10 years ago

I’m personally a fan of [ys terminal](http://ysmood.org/wp/2013/03/my-ys-terminal-theme/). Pretty much all of the different themes show the same basic information. [Mine](http://d.pr/i/vhpY), for example, is pretty self explanatory (the green circle before the timestamp turns to a red x if I have uncommitted changes).

I find the timestamp useless, I just haven’t had the time to customize exactly how I’d like (nor the features I want). Unfortunately, my rMBP is primarily used as a desktop replacement, so a battery indicator doesn’t provide much added value…​ unless it was for my Logitech K800 and Performance MX! So, I’m looking forward to digging through Unifying drivers one day in search of what I need.

@Varun: My guess would be you are missing the leading escape character before those random characters you see (which would be color-codes, if the escape character was there).

?

Anonymous

0 points

10 years ago

@patrick91 I have the same problem, this is how I see the separator character: http://i.imgur.com/tJ5sHbs.png

?

Anonymous

0 points

10 years ago

Hey Remy,\ Thanks for sharing this. I have got it working after spending 20 min. Only thing is battery charge display. It is kind of overshooting on the next line and showing me some weird numbers also. such as\ 1;33m??????????\[00m

I am trying to figure out but still no success, can you please help?

![](/images/no-user.svg)

Nate Gardner

0 points

9 years ago

I have figured this out!

The color definitions were not correct in the original code. I solved this by editing two files:

  1. [batcharge.py](http://batcharge.py):

Where the colors are defined, edit them so it looks like this:

color\_green = '\e\[00;32m'\ color\_yellow = '\e\[00;33m'\ color\_red = '\e\[00;31m'\ color\_reset = '\e\[000;00m'

  1. remy.zsh-theme:\ Where color is set for ONLINE and OFFLINE:

ONLINE='\e\[00;32m◉'\ OFFLINE='\e\[00;31m⦿'

Save both files and open a new terminal. You’ll find that everything displays in the proper colors and that there are no more weird numbers. I’ve attached a screenshot of mine.

What I cannot figure out now is:\ The online indicator does not appear to work. When I disconnect from the internet it does not appear to change color or size, which makes me think it is hanging up somewhere else.\ The entire RPROMPT is shifted far to the left. I don’t know why, but it is always about 3x it’s width from the right side, so I have a lot of unused space now. However, this is way better than before!

![](/images/no-user.svg)

Nate Gardner

0 points

9 years ago

I’m having the same issue. While I haven’t been able to resolve this yet, I did find out that I could make the cursor go a line lower. I changed my RPROMPT in \~/.oh-my-zsh/themes/remy.zsh-theme to:

RPROMPT='%{$(echotc UP 1)%}$(prompt\_online) $(battery\_charge)%{$(echotc DO 1)%}'

And this makes the cursor start at the next line, allowing me to at least see what I’m doing.

?

Anonymous

0 points

10 years ago

@remy, thanks for reply, I’m not able to show that character: http://sht.tl/6Tlp7

I’m investigating

?

Anonymous

0 points

10 years ago

@Sarah I had the same problem on OS 10.7.5. I went to replace remy’s code with the one from Steve Losh ( [http://stevelosh.com/blog/2…​;](http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity) ) and replaced the arrows with remy’s squares and it worked for me.

?

Anonymous

0 points

10 years ago

love it! thanks!

?

Anonymous

0 points

10 years ago

@remy here is the screenshoot: http://sht.tl/PILBS

The character unicode code is U+25BA, let me know if is the same as yours :)

Thanks

![](/images/no-user.svg)

rem

0 points

10 years ago

@patrick91 - Looks like a different character:

\<img src="http://d.pr/i/MbmQ+">

You want U+E0B0.

?

Anonymous

0 points

10 years ago

Thanks for sharing the setup. I was trying to do the setup for myself and I have a problem with the [batcharge.py](http://batcharge.py)

My os is 10.8.4, I have both the default python version and 3.3.\ All setup is good (I can see the green light for connection, etc) except for the [batcharge.py](http://batcharge.py). When I open a iterm2 terminal it shows the following error messages:

\~/[batcharge.py](http://batcharge.py): line 6: import: command not found\ \~[batcharge.py](http://batcharge.py): line 8: syntax error near unexpected token `(' ~/[batcharge.py](http://batcharge.py): line 8: `p = subprocess.Popen(\["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)'

Any clue on what might be wrong? I tried with python3.3 but that throws different set of errors.\ Thanks.

?

Anonymous

0 points

10 years ago

I have an extremely similar terminal setup for myself, using zsh, Solarized (on a light background, I code in well-lit coffeeshops during the day), and Powerline. I haven’t been sold on iTerm2 yet, mostly because its another software package to install and configure, and I work across a lot of different OSX and Linux machines.

I feel like I should take 15 minutes now and see what its going to take to get iTerm2 working with Visor/TotalTerminal.

![](/images/no-user.svg)

haruspex

0 points

8 years ago

TotalTerminal was killed by OS X 10.11, and iTerm 2 can replicate the exact same function if set up properly. Create a Profile that looks/behaves like TotalTerminal. Create a new profile and set the Window Style to mimic what you preferred in TotalTerminal. Set up iTerm 2 Preferences > Keys to use a Hotkey to toggle that profile in the same way you could toggle TotalTerminal. Seriously, iTerm2 can do everything that TotalTerminal could do. Reply if you need help tweaking it to how you want it.

![](/images/no-user.svg)

rem

0 points

10 years ago

@Charles - I used to be a big fan of visor, but I’ve now got iTerm hooked up to cmd+esc to show and hide. It’s total muscle memory now, if nothing happens (when I’m on someone else’s machine), I’m totally confused!

![](/images/no-user.svg)

rem

0 points

10 years ago

@patrick91 - I think whatever character you entered got lost in the comment. Can you try again (maybe check if you need to escape it)

@Ben - you need to go through the setup process to use zsh: https://github.com/robbyrussell/oh-my-zsh (it was in the TL;DR bit). Once you’ve got oh-my-zsh installed, you’ll have a directory in your home directory ~ called .oh-my-zsh/themes/. Put the theme in there, and edit ~/.zshrc to point the theme to that file. All this install process should be in the link I’ve posted (I just checked myself and it looks to be there).

?

Anonymous

0 points

10 years ago

I just spent about an hour googling about trying to figure out what to do with the gist you have shared. Where do I put this file or how do I import it? I imported the solarized colours through the profile editor, but I can’t get it to accept the remy.zsh-theme file.

I think I am being a major dumbass!

?

Anonymous

0 points

10 years ago

What’s the character used for SEGMENT\_SEPARATOR?\ this one ? doesn’t look good

?

Anonymous

0 points

10 years ago

Many thanks for this! When I saw a presentation you did, I wanted to copy your iTerm setup, but I couldn’t find the right powerline font, and the one I had wasn’t giving me the arrowheads and other non-ASCII characters.

Great setup! <3

?

Anonymous

0 points

10 years ago

Remy, thanks for posting this! I have seen this set-up elsewhere and could not find a good explanation on Google.

![](/images/no-user.svg)

rem

0 points

10 years ago

@Simon: iterm handles split windows really, really, REALLY well. Agnoster (and thus zsh) gives me instant information about the git repo I’m working out of. If you saw the screenshot at the top of the post it tells me:

  1. I’m in the master banch\

  2. ± means the working directory is dirty (there’s files that git doesn’t know about)\

  3. as it’s blue, I know there’s nothing waiting to be staged

zsh also gives me the right hand prompt (which I’m sure there’s some other shells that have it, but the point is all these features are useful to me).

It’s also got a very good history extension.

So I can type z jsbin anywhere and I’ll change to the /Users/remy/Sites/jsbin/ directory.

Or I can type the beginning of a command, like cat and cursor upwards and it’ll only show me the history of commands starting with "cat".

?

Anonymous

0 points

10 years ago

Wondering what are the main pros of zsh, agnoster and iTerm 2 you find useful?

[Commento](https://commento.io)