- Introduction and Other Resources
- Install Developer Applications
- Configure CLI
- Common Workflows
- DANGER - DO NOT RUN THESE UNLESS YOU KNOW WHAT YOU ARE DOING
If you are not on a machine with an Apple M1 Chip be aware that there will be a few extraneous steps and commands throughout this gist. But for the most part if you ignore those commands and leave them out then mostly everything else should be fairly agnostic to Apple M1, Apple x86, or Linux.
Unfortunately, if you're on Windows you'll be hard pressed to find a single section of this gist that isn't broken or incompatible. On the bright side, that means you can write your own Useful Snippets gist for Windows users and you'll save a couple million people a few billion headaches.
Other good resources:
- Robin Wieruch's 2023 Mac Setup for Web Development
- Swyx's 2022 New Mac Setup
- Sean Washington Uses
- Everything Nexxel Installed on His New 2023 Mac
- Christoph Nakazawa Sets up a new Mac, Fast
- VS Code cause I'm too lazy to learn Vim
- Xcode Command Line Tools cause Git won't work without it
- Warp cause I like their default setup and don't want to go down the rabbit hole of terminal config
Install and Configure Homebrew
After running the install script, we'll run a handful of commands to create a .zprofile file which will set the Homebrew path with shellenv. I also turn off analytics with the final command but that is not a required step.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install Homebrew
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> $HOME/.zprofile # Create .zprofile shell startup file with command to setup a Homebrew environment
cat $HOME/.zprofile # Display contents of .zprofile
eval "$(/opt/homebrew/bin/brew shellenv)" # Setup Homebrew environment in current terminal session
brew analytics off # Turn off data collection for analyticsbrew -v # Check Homebrew version
brew -h # Homebrew help command
brew config # Check Homebrew configInstall CLIs and Utility Packages with Homebrew
brew install oven-sh/bun/bun colima deno docker docker-compose docker-credential-helper ffmpeg flyctl gh httpstat jq pnpm railway tree webp yt-dlpThere are many ways to see what has been installed with Homebrew including commands such as list, deps, and leaves. To list top level brew packages and descriptions, run:
brew leaves | xargs -n1 brew desc --eval-all --formulaInstall Volta and Node
curl https://get.volta.sh -s | bash # Install Voltavolta install node@22 # Install Node 22
node -v # Verify correct version of Node has been installedInstall Node CLIs with Volta
volta install tsx tscList all tools installed with Volta:
volta listOther ways to inspect your Volta/Node/npm packages and general locally installed binaries:
ls /$HOME/.volta/bin # List all JavaScript packages installed and managed with Volta by inspecting `.volta/bin`
npm list --location=global --depth 0 # When installing all global Node packages through Homebrew/Volta, listing globally installed npm packages contains only `corepack` and `npm`
ls /usr/local/* # View binaries installed locally through specific shell script files instead of Homebrew/VoltaList
tree /usr/local/ -L 2 # List locally installed binaries a different wayInspect your Volta configuration file:
cat $HOME/.volta/tools/user/platform.jsonSince I installed a specific legacy version of yarn and opted not to use Volta's experimental pnpm support (see GitHub Issue #737), this outputs the following on my machine:
{"node":{"runtime":"20.12.0","npm":null},"pnpm":null,"yarn":"1.22.22"}Authenticate CLIs for GitHub, Railway, Netlify, Vercel, and Wrangler.
# Run `gh status` or `gh help` for more info
gh auth login
# Run `ntl status` or `ntl help` for more info
ntl login
# Run `vercel whoami` or `vercel help` for more info
vercel login
# Run `railway whoami`, `railway status`, or `railway help` for more info
railway login # or `railway login --browserless` for browserless login
# TODO: wrangler loginSet name, email, default branch, and automatic remote pushing.
git config --global init.defaultBranch main
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"
git config --global --add --bool push.autoSetupRemote true
git config --global http.postBuffer 524288000The last configuration, http.postBuffer, increases the buffer size to 500 MB so pushes on repos over 50 MB don't fail. These changes can be seen in your .gitconfig file (scroll down to other attached files to see my .gitconfig file).
Create and Push a Public GitHub Repo
mkdir github-cli-example
cd github-cli-example
echo '# GitHub CLI Example' >> README.md
git init
git add .
git commit -m "do the thing"
gh repo create github-cli-example \
--public \
--push \
--source=. \
--description="An example GitHub repo created and pushed to main with the GitHub CLI." \
--remote=upstreamDeploy PostgreSQL Database with Railway
railway init -n example
railway add -p postgresql
railway openCreate aliases in .zshrc
Add the following lines of code to .zshrc:
alias ignore='echo ".DS_Store\nnode_modules\n.env\n.env.local" > .gitignore'
alias gs="git status"
alias gi="git init"
alias gc='git add . && git commit -m "commit"'
alias gp="git push"
alias t="tree -I node_modules -I whisper.cpp"
alias ls="ls -1"
alias ni='npm init -y && npm pkg set type="module"'
alias path='echo "$PATH" | tr ":" "\n" | nl'ignorealiases toecho ".DS_Store\nnode_modules\n.env\n.env.local" > .gitignorefor creating a custom.gitignorefile that ignores.DS_Storefor Mac users,node_modulesfor JavaScript projects, and.env/.env.localfor sensitive API keys.gialiases togit initfor initializing a Git repositorygsaliases togit statusfor checking the status of commitsgcaliases togit add . && git commit -m "commit"for automatically staging and committing changes (only use for solo projects where you do not wish to have meaningful commit messages to explain changes over time)gpaliases togit pushto push all new commitstaliases totree -I node_modulesfor printing a project's directory structure while ignoring anynode_modulesdirectorieslsaliases tols -1so files/directories displayed in the current working directory are listed one per linenialiases to a modification ofnpm initwhich runsnpm pkg set type="module"to settypetomoduleinpackage.jsonafter initialization.pathaliases toecho "$PATH" | tr ":" "\n" | nlwhich displays an easily readable list of path variables instead of the single line of variablesecho $0outputs
Current dotfiles (.zprofile, .zshrc, profile, and .gitconfig) are included at the bottom of the gist after the final DANGER section.
TODO: Better dotfile management.
Reset PATH to system default, uninstall/delete Homebrew/Volta and associated packages, and reset zsh dotfiles
# Reset PATH to default
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
# Delete Volta and all installed packages
rm -rf $HOME/.volta
# Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
# If anything remains after uninstalling for some reason, you can delete the entire Homebrew directory
rm -rf /opt/homebrew
# Reset zsh dotfiles
rm -rf $HOME/.zprofile $HOME/.zshrc $HOME/.zsh_history $HOME/.zsh_sessionsInstall Go and IPFS
No longer using Go or IPFS Kudo, migrating to Helia.
# Install Go
curl --remote-name https://dl.google.com/go/go1.20.4.darwin-arm64.pkg
sudo installer -pkg go1.20.4.darwin-arm64.pkg -target /
rm go1.20.4.darwin-arm64.pkg
go version # open new terminal and check go version# Install IPFS Kudo
curl --remote-name https://dist.ipfs.tech/kubo/v0.16.0/kubo_v0.16.0_darwin-arm64.tar.gz
tar -xvzf kubo_v0.16.0_darwin-arm64.tar.gz
sudo bash kubo/install.sh
rm -rf kubo kubo_v0.16.0_darwin-arm64.tar.gz
ipfs --version # ipfs version 0.16.0Install Rustup
Not installing right now cause Rust is cool but writing Rust is a lifestyle and I'm not ready for a long term commitment. And anyway, at this point shouldn't I just learn Zig instead?
curl https://sh.rustup.rs -sSf | sh # Select 1) Proceed with installation (default)
source "$HOME/.cargo/env"Install and Configure AWS CLI
No longer using AWS CLI cause YOLO.
curl --remote-name "https://awscli.amazonaws.com/AWSCLIV2.pkg" -s # Download the AWS CLI installer
sudo installer -pkg AWSCLIV2.pkg -target / # Use the installer command to unzip the package
rm AWSCLIV2.pkg # Delete the installer package
aws configure # Configure AWS Access Key ID and Secret Access Key
aws --version # Check AWS CLI version
Very cool, thank you for sharing