DEV Community

Cover image for My New Macbook Setup (2022)
nazha
nazha

Posted on

My New Macbook Setup (2022)

This post will be continuously updated in the my github repository https://github.com/maoxiaoke/setup-a-mac-for-frontend-dev.

Setting up a new Macbook will be tough and cumbersome. Every time I am getting a new Macbook, I go over the same steps on how to set it up for my working experience.

I create a record of my setup, hoping it's helpful for others too!

Immediate Frist Steps

Enable Tap to Click

When setting up a new Macbook, one of the first changes we make is enabling the tap-to-click feature for the trackpad.

Go「System Preference -> Trackpad -> Point & Click」and enable 「Tap to click」 option.

Enable Three Finger Dragging

In general, "tap to click" on your Macbook to avoid a force-click on the trackpad. But this doesn't work when it comes to dragging and repositioning windows.

Also, I'm big fan of tree finger dragging.

  1. Go 「System Preference -> Accessibility」.
  2. In the Accessibility sidebar, choose option 「Pointer Control」.
  3. Click the button 「Trackpad Options」.
  4. Enable dragging and select 「three finger drag」.

Change Wallpaper

Visit wallhaven to find a wonderful wallpaper and replace the default ones.

Download Edge

After discovering chrome are eating my old Mac's battery, I turned to use edge.

Install Homebrew

Homebrew is "The Missing Package Manager for macOS".

Simply follow their installation guide, copy /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" to terminal.

For GFW reasons, the Chinese users will fail to connect to github.

Just copy /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" to your terminal. It will do the same thing when installing homebrew.

Setup Terminal

Use iTerm2 as macOS terminal replacement.

  1. Use the Homebrew to install iTerm2
$ brew install --cask iterm2
Enter fullscreen mode Exit fullscreen mode
  1. Change a few settings of iterm2
  • Go 「iterm2 Preferences -> Profiles -> Default -> Window」, add transparency and blur.

  • Go 「iterm2 Preferences -> Profiles -> Default -> Keys -> Key Mappings」, replace the standard ones with the preset "Natural Text Editing".

  1. Install Oh My Zsh

The great thing about this is that you can customize your shell and add plugins. Unlike the old Bash shell, which does not look attractive and can make it difficult for you to use.

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode
  1. Choose your favorite theme

There are multiple themes you can choose from. My favorite theme is honukai and it should look like in the screenshot:

For compelete guide, dive into it's docs.

  1. Add useful oh-my-zsh plugins

Oh-my-zsh is powered by plugins. I'll share my top 3 plugins.

plugins=(
 git
 autojump
 zsh-syntax-highlighting
)
Enter fullscreen mode Exit fullscreen mode
  1. the git plugin

The git plugin is enabled by default. It provides many aliases and a few useful functions.

To use it, add git to the plugins array in your zshrc file:

plugins=(git)
Enter fullscreen mode Exit fullscreen mode
  1. the autojump plugin

Use Homebrew to install autojump.

$ brew install autojump
Enter fullscreen mode Exit fullscreen mode

After that, add autojump to your zshrc file:

plugins=(... autojump)
Enter fullscreen mode Exit fullscreen mode
  1. the zsh-syntax-highlighting plugin

The installation of zsh-syntax-highlighting may be tedious. But it worth the effort.

Clone the zsh-syntax-highlighting repository in oh-my-zsh's plugins directory:

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode

Then, activate the plugin in ~/.zshrc:

plugins=(... zsh-syntax-highlighting)
Enter fullscreen mode Exit fullscreen mode

After adding the plugins to your .zshrc file, you have to restart zsh to activate them, using the command source ~/.zshrc.

You can find all my settings of .zshrc here.

Install Alfred

Now, it is time for Alfred - an alternative for Spotlight.

Use Spotlight Keyboard Shortcut for Alfred

when installing Alfred, the first thing I do is disabling the default shortcut for Spotlight and use it for Alfred.

To do that, open System Preference -> Keyboard -> Shortcuts. Click on "Spotlight" and disable "Show Spotlight search".

Open the Alfred settings and use the freed up ⌘ Space combination to launch Alfred.

Clipboard History

Copy and pasting is something developers do everyday. Alfred ships with a clipboard manager which supports copied text, images and files.

The only thing I do is remapping the shortcut to ⌘ . to the Clipboard History.

Workflows

I do not have many workflows installed. One of my installed workflows is YoudaoTranslator, which provides translation service.

Follow the official guide to enable "YoudaoTranslator".

Development Tools

vscode

I prefer vscode to code. You can use github account to sync your setttings.

My favorite font is Overpass Mono and It should look like in the screenshot:

Launch vscode from the command line

Opening vscode from your terminal is a quick, easy way to open up new projects and begin coding faster.

Add the following text to your .zshrc files:

code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
Enter fullscreen mode Exit fullscreen mode

After restarting terminal or use source ~/.zshrc, you can open vscode by typing code ..

Here's how this should look:

pnpm

pnpm is fast, disk space efficient package manager, works as an alternative of npm.

Install pnpm using Homebrew:

$ brew install pnpm
Enter fullscreen mode Exit fullscreen mode

volta

I use volta to manage multiple Node.js versions.

Other Softwares

Whimsical

My favorite drawing app out there. Whimsical is so great that I compeleted most of my drawings (You can find them here and here).

Because Whimsical support PWA already. You can install it as normal apps.

obsidian

obsidian is my note-taking app I use.

Notion

Notion is where I writing articles.

Other Useful softwares

  • Shottr - Screenshot tool, it is powerful and easy to use.
  • Anki Notes - Memory app to learn English.
  • ScreenFlow - Video editing & screen recording.
  • kap - Screen recorder to generate gif.
  • magnet - Window manager.

Top comments (3)

Collapse
 
andrewbaisden profile image
Andrew Baisden

I use Notion and Obsidian too! How useful do you find Alfred? I ask because they say that Spotlight has caught up a lot now in terms of functionality?

Collapse
 
nazha profile image
nazha

I prefer Alfred becasue it provides workflows and short-cuts for web searching. For example, when I texted mdn string.matchAll, it will lead to mdn's pages of searching results.

Collapse
 
nazha profile image
nazha