# macOS My Way, Configuring the Terminal

During my time at tech, I have had the opportunity to work with some amazing people. Many of which had the best setup I have ever seen. I also had the opportunity to build, or image, hundreds of computers as a support engineer.&#x20;

Since the beginning of time, I've always looked for ways to automate my way out of menial tasks. Setting up macOS my way is one of them. I strongly believe a good UI experience in combination with the right tools can make a development setup MUCH more efficient.&#x20;

<figure><img src="https://2848260892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0icat2NyLOXwFzbdYWyk%2Fuploads%2FXV2FBzyUEMozigvTE5O0%2FScreenshot%202023-03-31%20at%2011.17.25%20PM.png?alt=media&#x26;token=b46d3c86-6b08-41fb-829b-c25c14a88bd9" alt="Part 1 will explain how to set up the terminal, the next section will explain how to set up vscode. "><figcaption><p>Part 1 will explain how to set up the terminal, the next section will explain how to set up <a href="https://code.visualstudio.com/">vscode</a>. </p></figcaption></figure>

However, as time passes, ways of doing things change. For that reason, I'm going to outline high-level instructions with one-liners that works as of the time of this writing. I'm not sharing my script because it is not future proof and I want this to work even when I'm 60. So here is the plan:

**Setting up the terminal**

1. [Open](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) the native macOS terminal:
2. [Install](https://brew.sh/) Homebrew, and follow the prompts:

   ```bash
   /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
   ```
3. Add Homebrew to your path (the end of the previous command will tell you exactly what to do):

   ```bash
   (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/matheo/.zprofile;
   eval "$(/opt/homebrew/bin/brew shellenv)"
   ```
4. [Install](https://iterm2.com/) iTerm2, we are going to brew it:

   <pre class="language-bash"><code class="lang-bash"><strong>brew install --cask iterm2
   </strong></code></pre>
5. [Instal](https://ohmyz.sh/#install) OhMyZsh:

   ```bash
   sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
   ```
6. [Install](https://github.com/romkatv/powerlevel10k#oh-my-zsh) PowerLevel10k:

   ```bash
   brew install romkatv/powerlevel10k/powerlevel10k
   echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
   ```
7. [Install](https://github.com/zsh-users/zsh-syntax-highlighting) syntax highlight:

   ```bash
   brew install zsh-syntax-highlighting
   ```
8. Add misc configs to zshrc:

   <pre class="language-bash"><code class="lang-bash">cat &#x3C;&#x3C;EOT >> ~/.zshrc
   HISTFILE=99999
   HISTFILESIZE=99999
   <a data-footnote-ref href="#user-content-fn-1">SAVEHIST</a>=$HISTFILESIZE
   alias hist="history 1"
   source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
   EOT
   </code></pre>
9. Open iTerm, and configure your preferences:

   ```bash
   exec zsh
   ```

<figure><img src="https://2848260892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0icat2NyLOXwFzbdYWyk%2Fuploads%2F5UN1BFGqq1EZC3HDASVl%2FScreenshot%202023-03-31%20at%2010.53.15%20PM.png?alt=media&#x26;token=99fb4818-3ee3-42d4-af85-0ab12cc1229c" alt=""><figcaption><p>If you don't get this screen right after <code>exec zsh</code>, try `source ~/.zshrc` or <code>p10kconfigure</code></p></figcaption></figure>

Few caveats:

* You need to have the right [fonts](https://github.com/romkatv/powerlevel10k#fonts) installed.
* You might want to change the theme by going to iTerm2 > Settings > Profiles > Clone Default > Color Presets > Pick whatever > Set as Default.
* You might want to set natural text edit (so you can use better shortcuts) by going to iTerm2 > Settings > Profiles > Keys > Key Mappings > Presets > Natural Text Edit > Keep.
* You can force quit the classic "Terminal" and pin iTerm2 to the dock.

That is it! In the next section, I'm going to outline how to integrate these terminal configurations into my favorite IDE.

Have fun, stay safe, and see you around!

[^1]:
