DEV Community

Jeremy Abbott
Jeremy Abbott

Posted on • Updated on

How I Setup My New Mac

This is copied from a github repo I made for myself for future reference. It is also in part inspired by John Papa's The First 10 macOS Apps I Install in 2019 . I wanted to emphasize what it feels like setting up developer tooling on macOS 10.15, and what my experience was like using zsh for the first time.

Scripts and notes regarding tools/apps I install when I get a new laptop. In general, I want to be able to build/run a SAFE Stack Application when setup is finished. To accomplish this I'll need

  1. .NET Core
  2. Node (we're going to use nvm for this)
  3. (Optional) Yarn
  4. (Optional) Docker (this could also be the first step if you only need/want to work in a .devcontainer)

Before we get into installing our developer tools though, we'll need to do some housekeeping.

Install OS Updates

This is especially worthwhile with macOS Catalina being so new and lamentably buggy. It's especially important if you (like me 💪🏼) treated yourself to the new 16" MacBook Pro because you'll want to make sure you have the latest driver and firmware updates. It's also just a good idea in case there are any security fixes (🤞🏽).

Remove Crap from the Dock

On a clean macOS install there's going to be a bunch of stuff on the dock that you probably don't want. Get rid of it 😉!

Alt text

Password Manager

Get your password manager installed. I use 1Password, and I installed it from the App Store.

Content Blockers

I generally use Firefox Developer Edition for standard browsing. However, when I'm shopping online I use Safari if the site I'm using supports Apple Pay. I use Better Blocker in that case.

Homebrew

Install homebrew.

  1. Open up your terminal
  2. Run this: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After getting homebrew installed I installed the following

brew install mkcert
brew cask install docker
brew cask install visual-studio-code
brew cask install dropbox
Enter fullscreen mode Exit fullscreen mode

After you install VS Code you're going to have to do some permission tweaking.

Homebrew or App Store?

At least 1Password can be installed via Homebrew as well as available in the App Store. Which way should you do it? My best guess is honestly personal preference. For things that I just need to work no matter what (like password access), I think something from the App Store has a better change of working correctly after a major OS upgrade. I don't have any evidence this to back this up though, so let's go with personal preference. 🤷🏽‍♂️

Other apps I installed via the App Store

Antigen

With macOS Catalina, macOS uses zsh as the default terminal instead of bash. From the little bit I've interacted with it, I haven't noticed a difference. I came across Antigen while looking for the best way to install nvm. While perusing the readme I came across this

Homebrew installation is not supported. If you have issues with homebrew-installed nvm, please brew uninstall it, and install it using the instructions below, before filing an issue.

Well 💩.

However, I also saw this tidbit

Note: If you're using zsh you can easily install nvm as a zsh plugin. Install zsh-nvm and run nvm upgrade to upgrade.

Cool... Looking at the zsh-nvm installation instructions, it lists Antigen first. Well that doesn't sound scary at all.

Antigen manages plugins for zsh. Before this little adventure I didn't even know there were plugins for zsh. As it turns out we can install antigen via homebrew

brew install antigen
Enter fullscreen mode Exit fullscreen mode

After antigen is installed do the following

cd $HOME
touch .zshrc #creates the file if it doesn't exist
Enter fullscreen mode Exit fullscreen mode

Then add this to your .zshrc

source /usr/local/share/antigen/antigen.zsh

antigen bundle lukechilds/zsh-nvm

antigen apply
Enter fullscreen mode Exit fullscreen mode

Plot twist: you can also install antigen before Homebrew, and then setup Homebrew as an Antigen bundle. I'm not sure which step is better.

With nvm finally installed

nvm install --lts
nvm use --lts
Enter fullscreen mode Exit fullscreen mode

Installing .NET Core

Unfortunately, we don't (yet) have a cool tool like nvm for managing .NET Core SDK installations. You could install .NET Core via homebrew, but that's only going to get you one version. That might be enough for you. Reality is never that simple though. As I'm writing this .NET Core 2.1 is LTS, .NET Core 2.2 and 3.0 are supported, and 3.1 preview 3 is supported in production by Microsoft with 3.1 releasing next week (2019/12/2). 3.1 will be an LTS release. So you will probably want the latest 2.1 SDK, in addition to a 2.2 and 3.0 SDK. You could manually intall the pkgs from the .NET site. I'd like to be able to install from the command line though. Enter dotnet-install.sh

Download the script. I did it through the documentation link since I was already there. You'll probably want to move it to wherever you keep your scripts ($HOME/code for me).

Then run

chmod u+x dotnet-install.sh
./dotnet-install.sh -c Current # 3.0
./dotnet-install.sh -c LTS # 2.1
./dotnet-install.sh -c 2.2 
Enter fullscreen mode Exit fullscreen mode

Unless you specify an install directory, the dotnet executable is going to get intalled to $HOME/.dotnet, which you'll need to add to your path by adding the following to .zshrc

if [ -d "$HOME/.dotnet" ] ; then
    export PATH="$PATH:$HOME/.dotnet" # Add the directory where the dotnet executable lives
fi

if [ -d "$HOME/.dotnet/tools" ] ; then
    export PATH="$PATH:$HOME/.dotnet/tools" # Add the directory where dotnet global tools are going to be saved
fi
Enter fullscreen mode Exit fullscreen mode

Install my Favorite .NET Core Templates

dotnet new -i "MiniScaffold::*" # MiniScaffold is the bomb https://github.com/TheAngryByrd/MiniScaffold
dotnet new -i SAFE.Template # you should be using the safe stack https://safe-stack.github.io/
Enter fullscreen mode Exit fullscreen mode

I literally went through all that work (above) to get nvm installed so that I could build SAFE Stack apps.

Wrapping Up

A copy of my current .zshrc can be found here.

One thing I haven't done yet is installed a zsh theme. Do you have any you like? Do you have a more automated way of getting your developer setup just right?

Update 2019-12-12

Go install the super cute Touchbar Pet app


Top comments (2)

Collapse
 
sebastianpe profile image
Sebastian

Congrats on your new mac, and thanks for the post.
You might also want to check out the ASDF version manager. It allows you to manage your node, dotnet (and a whole bunch of other languages) all in one. And picks the right versions based on a .tool-versions-file in your repo.

Collapse
 
adz profile image
Adam Davies • Edited

Thanks for your post. Did not know about that installer script.

I've been using asdf for both dotnetcore and node. Been all good except needing DOTNETHOME to be set in v2.