Skip to content

Instantly share code, notes, and snippets.

@rmrfslashbin
Last active December 26, 2024 03:55
Show Gist options
  • Save rmrfslashbin/2e0aeace8f170c08bc13f61a0b44a089 to your computer and use it in GitHub Desktop.
Save rmrfslashbin/2e0aeace8f170c08bc13f61a0b44a089 to your computer and use it in GitHub Desktop.
Minimal MacOS setup guide. System/UI and CLI (zsh, Oh My Zsh, brew, etc).

So You Got a Mac.

First, congrats! You're more special than the people lost in Windowz land. But not as cool as the Linux kids. It's a trade-off. These are the things I did to set up my nifty new MacOS system.

ToC

Why MacOS?

It just works. As my previous laptop was nearing the end of its life, I wanted to buy a lightweight laptop with good battery life and didn't require too much frustration. Linux-on-the laptop is still "just another year away," and my experience in that domain left me frustrated.

While MacOS and Apple have some less-than-optimal aspects, a shiny new M1-based laptop is a good experience. After a few trashed systems and a "wtf is this running so slow," I repaved the laptop one more time with a minimal setup. These are my notes.

Let's dive in!

Drag away all the crap, keep the stuff you actually want.

Delete the crap you'll never use, like Garage Band. Ignore the "baked in" stuff you can't delete, like Apple Maps.

System Preferences needs some fix ups.

  • General
    • Appearance: Dark
    • Default web browser: Vivaldi
    • Uncheck: Close windows when quitting an app
  • Desktop & Screensaver
    • Set a relaxing desktop photo.
  • Dock & Menu Bar
    • Dock Size: Smaller.
    • Menu Bar: Uncheck Automatically hide and show the menu bar in full screen
  • Mission Control
    • Uncheck: Automatically rearrange Spaces based on most recent use. (srsly, stop moving my cheezzzz).
    • Hot Corners: Set them up as desired. (UL: Mission Control, LL: Launchpad, UR: Notification Center, LR: Quick Note)
  • Siri: She wasn't enabled at install time. I don't want to talk to my computer. Pretend she doesn't exist.
  • Language & Region: Time Format, ☑️ 24-Hour Time
  • Security & Privacy
    • General: ☑️ Require password "immediately"...
    • Firewall: Turn it on and enable stealth mode.
  • Keyboard
    • Key Repeat: Fast
    • Delay Until Repeat: short
    • Modifyer Keys: change Caps Lock to Control.
  • Trackpad
    • ☑️ Secondary Click
    • ☑️ Tap to click
    • Tracking speed: faster
  • Displays: Scaled, More Space
  • Sharing
    • Computer Name: Name your computer. Don't let it feel sad and unloved.

Apps to get things started. Configure as needed.

App Use
Vivaldi It's like Chrome, but WAY better.
vscode You know, for code.
FiraCode A nice, easy to read font for code and monotype situations.
Singal Cool people use Signal.
ProtonVPN For VPN'ing.
Spotify Music.
iTerm2 For a better CLI experience.

FireCode is pretty easy to install. Just follow the instructions. Where applicable, enable ligatures, especailly in vscode and iTerm2 (they are nifty).

ProtonVPN.

Configure according to your personal level of paranoia. One nifty upside, you can enable Wireguard. The ProtonVPN app will walk you through the enablement of system extensions to make it all happen.

CLI.

If you don't care about or use a CLI, you can skip the rest of this guide, but that would be sad. Learn to love your CLI. This guide assumes you already know your way around a CLI and use the MacOS default shell, zsh.

iTerm2.

iTerm2 is highly customizable. Spend some time checking out the configurables. Here's a few things I set:

  • General
    • Startup: Window restoration policy. I set "Use system window restoration setting" which was set in System Prefs (above) in general -> Close windows when quitting an app .
    • Services: ☑️ Check for updates automatically
    • Selection: ☑️ Copy to pasteboar on selection; ☑️ Applications in terminal my access clipboard; ☑️ Triple-click select entire wrapped lines.
  • Profiles
    • Text: Cursor: Underline
    • Text: Font: Use Fira Code retina 12pt
    • Text: Font: ☑️ Use ligatures
    • Window: Columns: 90, Rows: 30, Uncheck Use transparency
    • Terminal: ☑️ Unlimited scrollback
    • Terminal: ☑️ Silence bell
  • Pointers
    • General: ☑️ Three-finger tap emulates middle click

Oh My Zsh!

Oh My Zsh makes zsh even more useable and customizable.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Homebrew.

Use Homebrew to install all the old friends and some new toys.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the instructions and then install some stuff.

brew install awscli bat coreutils diff-so-fancy fd fzf gh git go imagemagick neovim node ripgrep tree

Package Use
awscli AWS CLI
bat Like cat, but better
coreutils All your old favorites
diff-so-fancy Makes diff readable
fd A replacement for find
fzf Fuzzy searches
gh Github CLI
git Git...
go The Go language.
imagemagick CLI image tools
neovim VI/VIM replacement
node Node.js and friends
ripgrep A replacement for grep
tree like find, but with a tree

Pay attention to the final output. There are likely config/activation items you shoud do.

Git.

Assuming git has already been set up (or you already have a .gitconfig), here's a few handy things to add.

# use diff-so-fancy and bat to make things look better
git config --global core.pager "diff-so-fancy | bat -p"
git config --global interactive.diffFilter "diff-so-fancy --patch"\n

# useful for cases of multiple remotes
git config --global alias.pushall "\!git remote | xargs -L1 git push --all"

# kill the enabled-by-default branch pager (why was this a thing?)
git config --global pager.branch false

It's beyond the scope of this doc, but consider setting up gpg/pgp code signing. Also, don't forget to config --global your user.name and user.email.

Zsh and Oh My Zsh.

First, pick a Oh My Zsh Theme. I'm currently using bira. It has all the stuff I need (hostname, user, and full cwd path), includes Git integrations, and leverages two lines: one for the infos and one for the prompt. Yeah, it takes up more space, but I get everything I want. YMMV. Prompts are deeply personal. I won't judge.

# .zshrc
...
ZSH_THEME="bira"
...

Which looks like this:

╭─rmrfslashbin@manual-fork ~/src/github.com/rmrfslashbin/rmrfslashbin.io ‹main›
╰─$ ls
LICENSE   README.md  dist        node_modules       package.json  src
Makefile  deploy.sh  index.html  package-lock.json  public        vite.config.js

Next, fix up plugins to leverage Oh My Zsh Plugins

# .zshrc
...
plugins=(aws brew colored-man-pages git gitignore ripgrep ssh-agent)
...

Add some aliases, helper functions, and use neovim as the default editor.

# .zshrc
...
export EDITOR='nvim'
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export FZF_DEFAULT_COMMAND='fd --type file --follow --hidden --exclude .git --color=always'
export FZF_DEFAULT_OPTS="--ansi"
alias grep="rg"
alias cls="clear;reset"
alias ls="ls --color"
alias diff="diff -u"
alias cat="bat"
alias find="fd"
alias vi="nvim"
alias vim="nvim"
alias preview="fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"

randpw() {
    # default length, 24
    len=24
    if [ ! -z "$1" ]; then
        len="$1"
    fi
    </dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c$len; echo ""
}
...

Make It So.

Finally, restart the terminal session or source the env source ~/.zshrc ~/.zprofile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment