<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lukas Gabsi</title>
    <description>The latest articles on DEV Community by Lukas Gabsi (@gabsii).</description>
    <link>https://dev.to/gabsii</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F201520%2F08402653-6c6c-4217-b12e-7e9d40257f41.png</url>
      <title>DEV Community: Lukas Gabsi</title>
      <link>https://dev.to/gabsii</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gabsii"/>
    <language>en</language>
    <item>
      <title>2020 🍀 macOS Terminal Setup (zsh + 🚀 + iTerm)</title>
      <dc:creator>Lukas Gabsi</dc:creator>
      <pubDate>Mon, 06 Jan 2020 16:16:34 +0000</pubDate>
      <link>https://dev.to/gabsii/2020-macos-terminal-setup-zsh-iterm-1nln</link>
      <guid>https://dev.to/gabsii/2020-macos-terminal-setup-zsh-iterm-1nln</guid>
      <description>&lt;p&gt;With a new job comes a new laptop. Part of my current working contract is that I get a company laptop which I am also allowed to use for personal purposes. Since now 2 months I have had more than enough time to develop a personal configuration that helps me work more efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  My (work) Laptop
&lt;/h2&gt;

&lt;p&gt;Right after I had my trial day I got asked about my preferred environment for development. My choice was between a Windows laptop and a Macbook Pro and since the company standard kinda leans towards Macbooks and since I heard a lot of good stuff about programming on an OSX machine I quickly decided to give the Macbook a try.&lt;/p&gt;

&lt;p&gt;So now here I am with a Macbook Pro (13-inch, 2019 edition) and I really enjoy working on it considering that a UNIX system offers a bit more customization compared to Microsofts Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Package Manager – homebrew
&lt;/h2&gt;

&lt;p&gt;Anyone who worked with a Linux computer before knows and appreciates the pros of a package manager. &lt;code&gt;apt&lt;/code&gt;, in my opinion, is a huge advantage of Linux as compared to Windows (although they unofficially have &lt;a href="https://chocolatey.org/"&gt;Chocolatey&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Sadly homebrew isn’t natively shipped with a Mac, but it is really simple and easy to install. Just open your Terminal and paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will automatically download and install the latest homebrew version from GitHub. After the installation is done you should get a success message confirming the successful installation. Good job, you’re now able to use &lt;code&gt;brew&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;brew&lt;/code&gt; concepts
&lt;/h3&gt;

&lt;p&gt;Homebrew can be split into two different types of packages that can be downloaded. &lt;strong&gt;Graphical Applications&lt;/strong&gt; (Chrome, Slack, Spotify, …) and &lt;strong&gt;Command-Line Applications&lt;/strong&gt; (zsh, php, mysql, …). They also distinguish themselves in terms of &lt;strong&gt;licensing&lt;/strong&gt;. Command-Line Applications are mostly distributed under an open-source license whereas Graphical Applications can run under any license including commercial ones.&lt;/p&gt;

&lt;p&gt;But now you might ask yourself, why is this so important?&lt;br&gt;&lt;br&gt;
Because they slightly differ in the way they are installed.&lt;/p&gt;

&lt;p&gt;Command-Line Applications are installed using &lt;code&gt;brew install foo&lt;/code&gt; while Graphical Applications are installed using &lt;code&gt;brew cask install bar&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Packages can also be split into binary packages (bottles) and third-party packages (taps) but these aren’t especially necessary for us now.&lt;/p&gt;

&lt;p&gt;A list of all formulae (packages) can be found &lt;a href="https://formulae.brew.sh/"&gt;on the official formulae website&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Terminal – iTerm2
&lt;/h2&gt;

&lt;p&gt;So now let’s put our newly acquired knowledge to good use! Open up your terminal and enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew cask install iterm2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This should install the iTerm2 Terminal with which I usually work. It offers a lot more configuration and support out of the box than to the natively shipped Terminal.&lt;/p&gt;

&lt;p&gt;Now let’s get the configuration part starting!&lt;/p&gt;

&lt;h3&gt;
  
  
  Fonts Configuration
&lt;/h3&gt;

&lt;p&gt;The default font of iTerm is kinda lame and doesn’t offer as much character support as we want to (e.g. ligatures, custom icons, etc.) so we’ll switch it to a Powerline font which offers all of those cool features.&lt;/p&gt;

&lt;p&gt;Thankfully there is already a whole repository of those fonts. Just go ahead and clone the &lt;a href="https://github.com/powerline/fonts"&gt;powerline fonts repository&lt;/a&gt; and install the fonts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/powerline/fonts.git 
cd fonts
bash install.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;em&gt;If your installation fails on the git part saying that the command wasn’t found, simply install it through brew using &lt;code&gt;brew install git&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that we have these fonts installed we need to configure our Terminal to use them. In your iTerm2 window navigate to &lt;code&gt;Preferences &amp;gt; Profiles &amp;gt; Text &amp;gt; Font&lt;/code&gt; and select a powerline font (they end in &lt;code&gt;for Powerline&lt;/code&gt;). I am using &lt;em&gt;Fira Mono for Powerline&lt;/em&gt; with a font size of 13px. Also, make sure to enable ligatures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--33IhrboH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-21.46.10-1024x524.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--33IhrboH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-21.46.10-1024x524.png" alt="enable ligature support"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure you check the ‘_Use ligature_s’ box&lt;/p&gt;

&lt;h3&gt;
  
  
  Color Scheme Configuration
&lt;/h3&gt;

&lt;p&gt;The next thing we tackle is iTerm2’s default color scheme. The probably most important visual change we make.&lt;/p&gt;

&lt;p&gt;Gladly some smart guys also made a repository for that called &lt;a href="https://github.com/mbadolato/iTerm2-Color-Schemes"&gt;mbadolato/iTerm2-Color-Schemes&lt;/a&gt;. You can view all themes on the website &lt;a href="https://iterm2colorschemes.com/"&gt;iterm2colorschemes&lt;/a&gt;. After choosing a theme we clone the repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To use the color scheme in your terminal navigate to &lt;code&gt;Preferences &amp;gt; Profiles &amp;gt; Colors&lt;/code&gt; and import them from your folder. I personally enjoy the colors the Chester theme offers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oog3w1MO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-21.59.24-1024x818.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oog3w1MO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-21.59.24-1024x818.png" alt="Import your preferred color scheme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Import your preferred color scheme&lt;/p&gt;

&lt;p&gt;For the background, I also played around with the transparency and blur options located in the &lt;code&gt;Window&lt;/code&gt; tab.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keys Configuration
&lt;/h3&gt;

&lt;p&gt;Only a small but very important change to me. By default, the iTerm scheme won’t let allow you to jump between your words as you expect it to. After some time I got used to pressing &lt;code&gt;⌥ (option) + arrow key&lt;/code&gt; to easily fix wrong input.&lt;/p&gt;

&lt;p&gt;The smart developers from iTerm2 quickly realized that the community wanted to use the natural keyboard functionality without much of a configuration and therefore added the Natural option by default.&lt;/p&gt;

&lt;p&gt;Simply navigate to &lt;code&gt;Preferences &amp;gt; Profile &amp;gt; Keys&lt;/code&gt; and select the &lt;em&gt;Natural Text Editing&lt;/em&gt; option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wW-uFN_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-22.15.09-1024x583.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wW-uFN_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-22.15.09-1024x583.png" alt="choose 'Natural Text Editing'"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;choose ‘Natural Text Editing’&lt;/p&gt;

&lt;p&gt;Now your editor is already on a visually good path I would say. But functionality-wise there are still a lot of improvements. This leads me to the next topic…&lt;/p&gt;

&lt;h2&gt;
  
  
  Z shell – zsh
&lt;/h2&gt;

&lt;p&gt;Zsh is a replacement for our o-so-beloved bash with much, much more functionality out of the box. Here are some of the major ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Automatic cd:&lt;/strong&gt; Just type the name of the directory to change to it&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Recursive path expansion:&lt;/strong&gt; For example “/u/lo/b” expands to “/usr/local/bin”&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Spelling correction and approximate completion:&lt;/strong&gt; If you make a minor mistake typing a directory name, ZSH will fix it for you&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Plugin and theme support:&lt;/strong&gt; ZSH includes many different plugin frameworks by default and offers you a lot of extensibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks to homebrew, the installation process is as easy as typing in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can confirm that the installation ran successfully by typing &lt;code&gt;zsh --version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Looks like nothing changed, doesn’t it? Well, that’s because we also need a configuration manager to add themes and plugins. Let’s get started with &lt;strong&gt;Oh My Zsh&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Oh My Zsh
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/robbyrussell/oh-my-zsh"&gt;Oh-My-Zsh&lt;/a&gt; is the most popular configuration framework for ZSH, which also comes with many built-in plugins and themes. To install it we once again enter stuff in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Oh My Zsh was installed without any problems? Nice. But… where are the changes? Don’t worry, for the changes to take place we need to restart iTerm. After the restart, your iTerm should look a lot better already. Now for the cool part.&lt;/p&gt;

&lt;h3&gt;
  
  
  Themes – spaceship
&lt;/h3&gt;

&lt;p&gt;Here the fun begins. Themes. The ability of mankind to change the appearance of the terminal itself. I tried many different themes before I found a good configuration setup.&lt;/p&gt;

&lt;p&gt;As already pointed out, Oh My Zsh comes with a lot of built-in themes. You can see all of them on the &lt;a href="https://github.com/robbyrussell/oh-my-zsh/wiki/Themes"&gt;Oh My Zsh Themes wiki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Nevertheless, I think most of the preinstalled themes look really bad and don’t offer a lot of useful information at first sight. That’s where I made myself on a journey to find the best theme (&lt;em&gt;warning: personal opinion&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/denysdovhan/spaceship-prompt"&gt;Spaceship&lt;/a&gt; is a great theme. It offers you the technology and its version, the repository status, and ligature support at first sight. To install it we, for the last time, clone the repository and symlink it to our config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Finally, we want to edit our &lt;code&gt;.zshrc&lt;/code&gt; located in &lt;code&gt;~&lt;/code&gt; and set &lt;code&gt;ZSH_THEME="spaceship"&lt;/code&gt; (Note: don’t add this line, find it and overwrite it). After restarting you should now have the spaceship theme installed.&lt;/p&gt;

&lt;p&gt;The theme also comes with a lot of configuration. You can read about it at the &lt;a href="https://denysdovhan.com/spaceship-prompt/"&gt;themes documentation&lt;/a&gt;. In my personal &lt;code&gt;.zshrc&lt;/code&gt; configuration file I use the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# SPACESHIP THEME CONFIG

SPACESHIP_DIR_PREFIX='' # disable directory prefix, cause it's not the first section
SPACESHIP_DIR_TRUNC='1' # show only last directory

# Package
SPACESHIP_PACKAGE_SHOW=false

SPACESHIP_PROMPT_ADD_NEWLINE=true
SPACESHIP_TIME_SHOW=true
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And in combination with all the (great) configurations we did earlier your terminal should look like this now:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g3gvNNKH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-23.15.56-1024x640.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g3gvNNKH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://wp.gabsii.com/wp-content/uploads/2019/11/Screenshot-2019-11-03-at-23.15.56-1024x640.png" alt="terminal with zsh theme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our beautiful terminal&lt;/p&gt;

&lt;h3&gt;
  
  
  Plugins
&lt;/h3&gt;

&lt;p&gt;Oh, baby, plugins will make your life so much easier, trust me. And adding them is even easier (thanks to Oh My Zsh). You can find a list of all pre-installed plugins on the &lt;a href="https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins"&gt;Oh My Zsh Plugins wiki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To add a plugin you simply edit the &lt;code&gt;.zshrc&lt;/code&gt; file and search for the plugins line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plugins=(git z zsh-syntax-highlighting zsh-autosuggestions lol thefuck)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt; zsh-syntax-highlighting and zsh-autosuggestions have to be installed separately, scroll down for the installation guides.&lt;/p&gt;

&lt;p&gt;If you want to I can write a more in-depth post about what those plugins do but here is a short summary.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;git&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;  Adds a lot of git aliases and functions for day-to-day git operations.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;z&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;  Change directory based on history for example if you previously used&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;zsh-syntax-highlighting&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;  Highlights Syntax in the Terminal&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md#oh-my-zsh"&gt;Installation Guide&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;zsh-autosuggestions&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;  Suggest commands based on your history and quickly access them&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh"&gt;Installation Guide&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;lol&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;  brings lulz to your zsh (based on lolbash)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;thefuck&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;  magnificent app which corrects your previous console command.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With all of these plugins installed your productivity will increase and your workflow is a lot more optimized.&lt;/p&gt;

&lt;p&gt;At this point, I want to thank you for sitting through and reading all of this post. I really hope I could help you with your configuration! 🙂&lt;br&gt;&lt;br&gt;
Right now I am thinking about making a second part about my personal setup, focused on my IDE setup. If you would like to read more about that, make sure to let me know in the comments down below!&lt;/p&gt;

&lt;p&gt;I hope to see you in my next post! &amp;lt;3&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>productivity</category>
      <category>terminal</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
