Setting Up A Dev Terminal
This week I start a new position at Kin+Carta and I have received a new Mac laptop. I thought it would be a good time to go over how I setup some of the tooling I use for local development and testing.
I am working with a brand new laptop. The first thing I will need is Homebrew. Just open up the default Mac terminal and paste the following
It took a few minutes but everything went smoothly on this new laptop.
I am not done with the default Mac terminal. I will use a Homebrew cask to install iTerm2.
And finally! I no longer need the default Mac terminal. ⌘+Q that thing and open up iTerm from the Applications folder.
Your Favorite Font
Monaco is the default font on Mac. If you are ok with that, great! I prefer Adobe's Source Code Pro. I am going to install it with ... you guessed it ... Homebrew.
A tap is a third-party repo. First you need to tap it. In this case we are tapping the Homebrew Cask Fonts repository. Second you install the font cask. A cask is an extension of of brew that allows for the management of graphical applications. This saves us from the old “To install, drag this icon…” instructions that would otherwise ensue.
Don't like Source Code Pro? Check out my other favorite Inconsolata from Google.
Next, I am going to make small tweaks to the default iTerm2 profile. This is up to your personal tastes of course. Here is the bare minimum to get me started.
Go to iTerm2 -> Preferences -> Profiles. Then in the Default profile I change the following.
Set the font to Source Code Pro.
Set the font size to 18. Because I have a big monitor and do not like to squint.
Set the transparency to 20%. Because I like to see what is going on behind the windows sometimes.
Set a background image, scaled to fill. I use one of Batman, looking back at me from the shadows.
Set the number of columns to 125 and rows to 30. I have a wide secondary screen. And it is also a good size on the laptop's display.
Set the Style to "Top of Screen" so that when a new terminal opens it is centered at the top of the current screen.
Bump the Scrollback lines to 10,000. Sometimes I am tracing logs and they get lengthy.
And that is about as much as I customize on the terminal. Next, the shell.
The default shell on Mac is ZSH. To verify just type in echo "$SHELL". The default prompt is pretty boring. And not informative at all. Over the years I toyed around with customizing it. Since I started to use ZSH, I found the quickest and easiest way is by using Antigen. Amongst other thins, I will use Antigen to load Oh My ZSH! plugins and themes.
To understand the relationship between ZSH, Oh My ZSH! & Antigen let me explain it this way. ZSH is just a unix shell. Oh My ZSH! is a collection of themes and plugins to help you configure that shell. And Antigen helps you manage those themes and plugins. Without Antigen, there would be some extra steps to download and configure the themes and plugins.
I am going to install Antigen with ... you guessed it ... Homebrew. Antigen is not a GUI application so it is not installed via a cask. It is just a formula.
Next, I need to create a new file new file in my home directory .zshrc
And in this file I am putting in the following
Once you are done, close your terminal and open a new one. When running for the first time, Antigen will download and run the bundles and themes configured. Powerlevel10k (my theme of choice) will begin a prompted configuration. Answer each of the questions to your liking.
⚠️ Once completed, if there is anything you don't like, you can always return to the configuration by using the command p10k configure.
⚠️ You will be prompted to install the Meslo Nerd Font for iTerm2. You can try it out if you wish and revert in the iTerm2 preferences.
My dotted, 2 line, 12h time format prompt. It is transient and is showing the current git branch.
Oh My ZSH! Plugins
I used Antigen to load the Powerlevel10k theme. Oh My ZSH! has several. Along with other plugins.
Let us add the following lines to .zshrc. Right before the theme line.
I am loading the following plugins
command-not-found will only source the handler that is called when ZSH can't find a command. You still need to install that via Homebrew.
With Homebrew I was able to quickly download and install iTerm2. Then I gave the ZSH shell a little boost with Antigen & Oh My ZSH!. I now have the basics that I need to install further tooling specific to AEM like Maven & Java. Check out my follow up post on how to setup jEnv and Maven.