Becoming familiar with your terminal and comfortable with its configuration is incredibly helpful when it comes to most, if not all, forms of software development. You could stick with the one-size-fits-all approach and work with the default configuration that your computer ships with out-of-box. Still, I believe that investing some time into personalizing your most fundamental tools is essential when it comes to optimizing your workflow and improving productivity.
Over the years, I've approached a comfortable configuration that works for me. I'll admit that this entire article is subjective because, after all, this is my preferred configuration. However, I hope that you may find some of these things to be helpful.
Note: I use iTerm2 as my default terminal emulator and Google Chrome as my default web browser. Some of the following commands reference these applications directly so I figured it was worth mentioning.
Let's get things started. Unfortunately, we have to start by installing MacOS developer tools. We can easily do this by installing Xcode via the App Store and then running the following command in the terminal.
xcode-select --install
Next, we need a package manager to install applications via the CLI easily. MacOS doesn't ship with one by default, so most people use Homebrew to accomplish this.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Now that we have our package manager installed let's download some packages!
brew install git vim zsh antigen cowsay fortune z thefuck
Okay, now that we have a few programs installed, let's shift our attention to Git. I use SSH to communicate with GitHub and other Git providers, so we will need to get an SSH key generated and registered. The following command generates an SSH key, copies it to your clipboard, and opens GitHub SSH settings in a new Chrome tab.
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa <<< y
cat ~/.ssh/id_rsa.pub | pbcopy
open -a "Google Chrome" https://github.com/settings/ssh/new
Alright, now let's talk about dotfiles. Dotfiles are where you store many of your program configurations via plaintext. You can find these in your home directory by typing "ls -la" and looking for files that start with a period. I like to track these via Git so I can share them between machines. I'm leveraging a "bare git repository," which isn't conventional, but I've found it to be the best approach for this use case.
compaudit | xargs chmod g-w
git clone --bare git@github.com:jacksonblankenship/dotfiles.git $HOME/.dotfiles
/usr/local/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME checkout && open -a iTerm . && exit
dotfiles config --local status.showUntrackedFiles no
I'm primarily a web developer, so I always need to make sure that I have node installed. I work on many different projects, so I like to use NVM to swap between node versions. The dotfiles installed via the previous command updated my .zshrc file which included "antigen bundle lukechilds/zsh-nvm". This command automatically made NVM available to us, so let's go ahead and install the latest version of node.
nvm install node
There are a handful of global node packages I often use, so we'll quickly install those.
npm i -g vercel firebase-tools
Alright, now let's shift our focus to Vim. If you're an Emacs fan, you can skip this 😄 Let's introduce our next package manager, Vundle. I use Vundle to personalize my favorite command line text editor, Vim. I've defined my Vundle plugins in a dotfile (see dotfile section of this article).
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
That's it! If you've followed each of these steps, your terminal should be identical to mine. My setup regularly changes, so this article is likely out of date when you're reading it, so if you'd like to see my latest configs check out this Gist to read more!