{"data":{"markdownRemark":{"id":"6ccb7f73-170c-5052-a5db-86ede1a36c17","html":"<p><img src=\"/media/iterm2_screenshot.png\" alt=\"finished terminal preview\" title=\"Fully Customized Terminal\"></p>\n<p>I was talking with my fellow interns about our personal workspace setups, and I was super surprised when two of them said they use the default Mac <code class=\"language-text\">terminal.app</code> with no customization whatsoever. I thought I was going to blow their mind when I whipped out my spiffy, colourful, dark-theme terminal prompt, but to my surprise, they were having none of it.</p>\n<p>”<em>Yeah, but it does the same stuff, so what’s the point?</em>”, one of them said.</p>\n<p>And then I froze… I didn’t have a response. Was it true? Was my gorgeous, fully customized terminal equivalent to the default, out-of-the-box version despite the countless hours I’ve devoted to the iterative process of creative the perfect command prompt? Was everything a waste of time?</p>\n<p>Or was I just so used to my <em>power-user-enabled</em>, <em>ergonimically-crafted</em>, <em>beeaaauuutiful</em>, that the advantages became second nature? Was I so comfortable with the brainchild I created that I started to take it for granted?</p>\n<p>The answer is… probably something in between. Anyways here’s a little guide on how I set up my terminal. Obviously you can (and should) change any of the configurations to your liking.</p>\n<hr>\n<p><em>Note: This guide only focuses on the aesthetic changes. I’ll be making another post about the added features and benefits of some of these changes.</em></p>\n<h2 id=\"0-install-brew\"><a href=\"#0-install-brew\" aria-label=\"0 install brew permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>0. Install Brew</h2>\n<p><a href=\"https://brew.sh/\">Homebrew</a> is a package manager for Mac (and Linux). If you’re doing any kind of software dev stuff on your Mac, you’ll probably end up using it to install packages and dependencies.</p>\n<p>In your command prompt, run the following command:</p>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre class=\"language-shell\"><code class=\"language-shell\">/usr/bin/ruby -e <span class=\"token string\">\"<span class=\"token variable\"><span class=\"token variable\">$(</span><span class=\"token function\">curl</span> -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install<span class=\"token variable\">)</span></span>\"</span></code></pre></div>\n<h2 id=\"1-set-up-iterm2\"><a href=\"#1-set-up-iterm2\" aria-label=\"1 set up iterm2 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Set Up iTerm2</h2>\n<p>iTerm2 offers a lot of benefits over the default Mac terminal… but I mostly use it because it supports a lot of different colours.</p>\n<h2 id=\"install-iterm2\"><a href=\"#install-iterm2\" aria-label=\"install iterm2 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Install iTerm2</h2>\n<p>Install iTerm2 <a href=\"https://www.iterm2.com/\">here</a> or run the following command:</p>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre class=\"language-shell\"><code class=\"language-shell\">brew cask <span class=\"token function\">install</span> iterm2</code></pre></div>\n<h3 id=\"customize-colours\"><a href=\"#customize-colours\" aria-label=\"customize colours permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Customize Colours</h3>\n<p>Open the application and navigate to the Colors tab (<code class=\"language-text\">iTerm2 -&gt; Preferences -&gt; Profiles -&gt; Colors</code>).</p>\n<p><img src=\"/media/iterm2_colors.png\" alt=\"iTerm2 Colors Tab Screenshot\" title=\"iTerm2 Colors Tab\"></p>\n<p>In the bottom right corner, you can select a preset. I’m rocking with a slightly altered <a href=\"https://draculatheme.com/iterm/\">Dracula</a> theme I think… I’m not sure. But you can download my presets <a href=\"https://github.com/hunterwatson/dotfiles/tree/master/terminal/color_presets\">here</a>. Here’s a side by side comparison with <code class=\"language-text\">meemoo</code> on the left and <code class=\"language-text\">yubah</code> on the right:</p>\n<p><img src=\"/media/iterm2_theme_comparison.png\" alt=\"iTerm2 Color Preset Comparison Screenshot\" title=\"iTerm2 Color Preset Comparison\"></p>\n<h3 id=\"change-font\"><a href=\"#change-font\" aria-label=\"change font permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Change Font</h3>\n<p>Navigate to the Text tab (<code class=\"language-text\">iTerm2 -&gt; Preferences -&gt; Profiles -&gt; Text</code>). At the bottom of the tab, you’ll want to change the font that supports special symbols. You can download my preferred fonts <a href=\"https://github.com/hunterwatson/dotfiles/tree/master/terminal/fonts\">here</a>, or you can check out <a href=\"https://github.com/ryanoasis/nerd-fonts#patched-fonts\">this</a> selection.</p>\n<h3 id=\"configure-other-iterm2-settings\"><a href=\"#configure-other-iterm2-settings\" aria-label=\"configure other iterm2 settings permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Configure Other iTerm2 Settings</h3>\n<p>Spend some time looking around the other settings tabs and change things to your liking. I don’t remember what I changed in here, but it should mostly be preference. One thing I have enabled is <code class=\"language-text\">Unlimited scrollback</code> from the Terminal tab (iTerm2 -> Preferences -> Profiles -> Terminal), which lets you scroll wayyyyyyy back to see your old stuff.</p>\n<h2 id=\"2-set-up-zsh-and-other-stuff\"><a href=\"#2-set-up-zsh-and-other-stuff\" aria-label=\"2 set up zsh and other stuff permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2. Set Up Zsh (and other stuff)</h2>\n<p>By default, your Mac uses <code class=\"language-text\">Bash</code>. Zsh (<em>sometimes called Z-Shell</em>) is a fancy shmancy version of it. I’ll get into some features later. <a href=\"https://ohmyz.sh/\">Oh my Zsh</a> is a configuration framework for Zsh. I don’t really know what it does, but I appreciate it.</p>\n<p>Install Zsh</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">brew install zsh zsh-completions</code></pre></div>\n<p>Install Oh my Zsh</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">sh -c &quot;$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)&quot;</code></pre></div>\n<h3 id=\"customize-your-zshrc\"><a href=\"#customize-your-zshrc\" aria-label=\"customize your zshrc permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Customize your <code class=\"language-text\">~/.zshrc</code></h3>\n<p>This file houses all the custom configurations we’re about to do. Remember that whenever you make a change you’ll need to run <code class=\"language-text\">source ~/.zshrc</code> or restart your terminal for the changes to take effect.</p>\n<h4 id=\"install-powerlevel9k-theme\"><a href=\"#install-powerlevel9k-theme\" aria-label=\"install powerlevel9k theme permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Install Powerlevel9k Theme</h4>\n<p>I like <a href=\"https://github.com/bhilburn/powerlevel9k\">Powerlevel9k</a> because it’s super customizable.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k</code></pre></div>\n<p>Add the theme to your <code class=\"language-text\">~/.zshrc</code> file</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">ZSH_THEME=&quot;powerlevel9k/powerlevel9k&quot;</code></pre></div>\n<p>Your prompt is gonna probably look absolutely wild, especially compared to the white, default terminal. Now is a good chance to <a href=\"https://github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config\">take a look at other people’s prompts</a> for inspiration. I think you can just copy-paste their config file into yours. <a href=\"https://github.com/hunterwatson/dotfiles/blob/master/terminal/.zshrc\">Here</a> is my personal configuration (what you saw in the screenshots). I think mine is pretty humble, but still makes me feel like I’m <em>hacking the mainframe</em>.</p>\n<h4 id=\"stylize-your-prompt\"><a href=\"#stylize-your-prompt\" aria-label=\"stylize your prompt permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Stylize Your Prompt</h4>\n<p>There’s a ton of options, all of which are explained in <a href=\"https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt\">the docs</a>, but I’ll walk through the user config part of my <code class=\"language-text\">~/.zshrc</code>. I’m going to ignore the plugins and some other utility stuff and just focus on the aesthetics, since I plan on covering functionality and additional features in another post.</p>\n<p>The first line sets what <a href=\"https://github.com/bhilburn/powerlevel9k/blob/master/README.md#available-prompt-segments\">prompt segments</a> you want to see. I wanted a simple design so my values are <code class=\"language-text\">dir</code> (directory: show the directory you’re in) and <code class=\"language-text\">vcs</code> (version control system: show some helpful git stuff). The lines after that are setting the symbol for separators, of which I don’t have any. </p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)\nPOWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=&#39; &#39;\nPOWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=&#39; &#39;\nPOWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=&#39;&#39;</code></pre></div>\n<p>The following line removes the prompt on the right hand side. I considered adding on to track the time, but it felt too cluttered to me.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">POWERLEVEL9K_DISABLE_RPROMPT=true</code></pre></div>\n<p>You can set the number of subdirectories to go down before it starts shortening the prompt. In my workspace setup, my terminal usually only has half of the screen, and I don’t want a long directory wrapping around and taking up two lines, so after the 5th directory it will shave them off the front.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">POWERLEVEL9K_SHORTEN_DIR_LENGTH=5</code></pre></div>\n<p><img src=\"/media/iterm2_shorten.png\" alt=\"subdirectories screenshot\" title=\"Shorten Subdirectories\"></p>\n<p>My prompt shows the directory and vsc information on one line, and the input on another. You can add this new line functionality by inserting the following lines. I chose to not have a prompt prefix on the first line, but use the class <code class=\"language-text\">$</code> on the one where I actually type stuff.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">POWERLEVEL9K_PROMPT_ON_NEWLINE=true\nPOWERLEVEL9K_PROMPT_ADD_NEWLINE=true\nPOWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=&#39;&#39;\nPOWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=&#39;$ &#39;</code></pre></div>\n<p>By default, Powerlevel9k has a bunch of icons in the prompt. I didn’t love it so I set them to a blank string.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">POWERLEVEL9K_ETC_ICON=&#39;&#39;\nPOWERLEVEL9K_FOLDER_ICON=&#39;&#39;\nPOWERLEVEL9K_HOME_ICON=&#39;&#39;\nPOWERLEVEL9K_HOME_SUB_ICON=&#39;&#39;\nPOWERLEVEL9K_VCS_BRANCH_ICON=&#39;&#39;</code></pre></div>\n<p>The rest of the prompt config lines are for colours. There are foreground and background components for each section of the prompt (dir, vsc, etc.); however, some of the sections can have different colours depending on what directory you’re in, the status of your git repository, and a couple of other things. You can find all the supported colours by running this snippet in your terminal:</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">for code ({000..255}) print -P -- &quot;$code: %F{$code}This is how your text would look like%f&quot;</code></pre></div>\n<hr>\n<p>Voila, if you’ve followed those steps (and used a little bit of critical thinking to cover the gaps I missed) you should have a nifty, new terminal set up just the way you like it (at least aesthetically). In the near future I’m going to post a Part 2 where I’ll cover some cool functionality of your new prompt, my favourite plugins, and some other technical things.</p>","fields":{"slug":"/posts/tinkering-with-my-terminal","tagSlugs":["/tag/terminal/","/tag/productivity/"]},"frontmatter":{"date":"2019-05-16T03:40:00.000Z","description":"A step-by-step guide on how I configure my terminal on MacOS using iTerm2, Zsh, and a whole bunch of other technologies. This post also includes a reference to my config file if anyone wants to copy my setup exactly.","tags":["terminal","productivity"],"title":"tinkering with my terminal"}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"/posts/tinkering-with-my-terminal"}}