Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

32.9 KB
Raw Blame

Terminal

Peel's Terminal page gives Terminal a theme and sets up the command line around it, on six tabs:

  • Themes: 29 dark themes, each a Terminal profile built on Apple's own Clear Dark.
  • Terminal: how Terminal opens, and the theme in use.
  • Shell, Git, and SSH: settings zsh, Git, and ssh already have, from their own manuals, each with a switch.
  • Tools: command-line tools worth having, with the commands that install them and set them up.

The Hadal theme in Terminal The Noctiluca theme in Terminal

Themes

Each theme is a Terminal profile built on Apple's own Clear Dark: the same font and window, with colors of its own, each checked for contrast against its background.

With Peel

The Terminal page starts turned off in Peel's sidebar: turn it on in Settings > General > Sidebar, or open it from the View menu. Choose a theme there, and Terminal opens with it and uses it in every new window. Put Back gives Terminal the profiles it used before and takes away Peel's own profiles that are still as Peel wrote them. Peel changes Terminal's profiles, and the one it opens with, only while Terminal is closed, and offers to quit it first.

Without Peel

Download a theme below: its link opens the file on GitHub, where Download raw file saves it. In Terminal, choose Terminal > Settings, click Profiles, and drag the file into the list of profiles, or click the Action pop-up menu and choose Import. Select the theme and click Default to open every new window with it. To have Terminal open with it too, as Peel does, click General and, next to "On startup, open", choose "New window with profile" and then the theme. Apple describes the steps in Import and export Terminal profiles on Mac and Specify default and startup Terminal window profiles on Mac.

The themes

The Aerogel theme in Terminal
Aerogel · Download
The Anodise theme in Terminal
Anodise · Download
The Borrow theme in Terminal
Borrow · Download
The Cavitation theme in Terminal
Cavitation · Download
The Cherenkov theme in Terminal
Cherenkov · Download
The Cinnabar theme in Terminal
Cinnabar · Download
The Cochineal theme in Terminal
Cochineal · Download
The Coherence theme in Terminal
Coherence · Download
The Coherence High Contrast theme in Terminal
Coherence High Contrast · Download
The Dichroic theme in Terminal
Dichroic · Download
The Effect theme in Terminal
Effect · Download
The Epitaxy theme in Terminal
Epitaxy · Download
The Fraunhofer theme in Terminal
Fraunhofer · Download
The Glacier theme in Terminal
Glacier · Download
The Hadal theme in Terminal
Hadal · Download
The Incandescence theme in Terminal
Incandescence · Download
The Noctiluca theme in Terminal
Noctiluca · Download
The Palimpsest theme in Terminal
Palimpsest · Download
The Passepartout theme in Terminal
Passepartout · Download
The Persistence theme in Terminal
Persistence · Download
The Provenance theme in Terminal
Provenance · Download
The Quantum theme in Terminal
Quantum · Download
The Riso theme in Terminal
Riso · Download
The Safelight theme in Terminal
Safelight · Download
The Selenium theme in Terminal
Selenium · Download
The Silverpoint theme in Terminal
Silverpoint · Download
The Stratum theme in Terminal
Stratum · Download
The Valence theme in Terminal
Valence · Download
The Verdigris theme in Terminal
Verdigris · Download

The Terminal tab

The Terminal tab, under When Terminal Opens and Theme in Use, can leave out the "Last login" line in new windows, keep Terminal from reopening its windows when it quits (its switch shows only while Terminal would reopen them), make Option the Meta key and silence the bell in the theme you use when it is one of Peel's, and show the line that stops the shell from saving its sessions, with a Copy button. Peel never edits your shell's files.

What each writes:

  • Leaving out the "Last login" line makes an empty ~/.hushlogin, the file login and sshd look for, so logins to this Mac over SSH leave the line out too; turning it off moves that file to the Trash, and History can put it back.
  • Option as Meta and the bell set useOptionAsMetaKey to true and Bell to false in the Peel profile in use. With Option as Meta, Option no longer types the characters it types on your keyboard, such as @ on a German keyboard.
  • Not reopening windows sets Terminal's NSQuitAlwaysKeepsWindows to false, at once even while Terminal is open, since Terminal reads it only when it quits.
  • The line that stops zsh from saving its sessions, SHELL_SESSIONS_DISABLE=1, goes in ~/.zshenv, for you to add. For bash, the command is touch ~/.bash_sessions_disable.

Shell, Git, and SSH

Every setting on these tabs is one that zsh, Git, or ssh already has, or ls for its colors, and each has a switch; the prompt is built from parts you choose. Peel never edits your shell's or ssh's own files, and changes Git's only through Git itself. Removing Peel leaves all of them in force, its two files included. Peel's record of what each Git setting held before, and of the profiles Terminal used, goes with Peel's own settings, so turn off first what you want put back.

  • zsh reads Peel's settings from a file of Peel's own, ~/Library/Application Support/Peel/Terminal/zshrc, once you add the line below to ~/.zshrc. The Shell tab gives a command that adds it at the end. If you load tools there, keep zsh-completions' lines above Peel's line, since its folder has to be in FPATH before the completion system starts, and Peel's file then doesn't start it again; below Peel's line, every new shell builds the completion system's cache, ~/.zcompdump, again. Move Peel's line above the other tools' lines, such as fzf-tab's, since their settings have to come after Peel's; zsh-syntax-highlighting's line stays the very last.
  • ssh reads them from ~/Library/Application Support/Peel/Terminal/ssh_config, once you add two lines at the end of ~/.ssh/config. The SSH tab gives a command that adds them, and makes ~/.ssh first when it isn't there. What you set for a server earlier in that file stays in force, since ssh uses the first value it finds.
  • Git's settings are changed with git config --global, Git's own command, and turning one off puts back what you had before Peel set it; a setting you made yourself goes back to Git's default. A setting that a file your Git settings include already sets, through include or includeIf, is left to that file: Git reads it where it is included and the last value wins, so a value Peel added would take its place in every folder it serves.

The line that makes zsh read Peel's file:

[[ -r "$HOME/Library/Application Support/Peel/Terminal/zshrc" ]] && source "$HOME/Library/Application Support/Peel/Terminal/zshrc"

Peel offers a setting only when the zsh, Git, or ssh on your Mac knows it, and the Shell tab's settings only when Terminal opens zsh. Turn All Off on each tab undoes what Peel set there; on the Git tab it also turns off what you set yourself, as its question says. Without Peel, add the lines below to ~/.zshrc or ~/.ssh/config yourself, or run the git config commands.

Prompt

The prompt is what zsh shows before each command you type. Peel builds it from parts you choose on the Shell tab: what comes before the symbol, the Git branch, the symbol, whether the symbol turns red after a command that fails, and whether the symbol and the command start a line of their own. The colors are the Terminal theme's, and the branch comes from zsh's own vcs_info. Peel writes no prompt until you turn on Use Peel's prompt. With it on, Peel asks zsh which prompt a new window shows, starting one as Terminal does, with your startup files: a prompt your ~/.zshrc sets after Peel's line, as Starship does when it is set up below that line, or one a function sets before each command, as Powerlevel10k does, is the one zsh shows, and the Shell tab says so and names the function when there is one.

A prompt with the folder, the branch, and a chevron Folder
The folder you're in, ~ at home, then the branch and the symbol. This is the prompt Peel starts with.
A prompt with the path from the home folder Path from your home folder
The whole path, from ~ in your home folder and from / outside it.
A prompt with the name, the computer, and the folder Your name, the computer, and the folder
As the prompt macOS sets begins, in color.
A prompt whose symbol starts a line of its own Command on its own line
The symbol starts a line of its own, so the command always has the whole width of the window.

The symbol is one of ❯ ➜ › ▸ » $ % >, each a character Unicode gives one column, so Terminal never draws it over the command. Peel writes % as %%, since a single one starts zsh's own codes.

The lines a prompt with the branch adds:

autoload -Uz vcs_info add-zsh-hook
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' formats ' %F{yellow}%b%f'
zstyle ':vcs_info:git:*' actionformats ' %F{yellow}%b%f %F{red}%a%f'
add-zsh-hook precmd vcs_info
setopt PROMPT_SUBST

Then the prompt itself, one line. These are the four above, and one with % that stays green after a failure:

PROMPT='%F{cyan}%1~%f${vcs_info_msg_0_} %(?.%F{green}.%F{red})❯%f '
PROMPT='%F{cyan}%~%f${vcs_info_msg_0_} %(?.%F{green}.%F{red})❯%f '
PROMPT='%F{green}%n@%m%f %F{cyan}%1~%f${vcs_info_msg_0_} %(?.%F{green}.%F{red})❯%f '
PROMPT=$'%F{cyan}%1~%f${vcs_info_msg_0_}\n%(?.%F{green}.%F{red})❯%f '
PROMPT='%F{cyan}%1~%f${vcs_info_msg_0_} %F{green}%%%f '

Shell

History

Setting What it does
Remember 50,000 commands zsh keeps your last 50,000 commands and saves all of them, instead of keeping 2,000 and saving 1,000 as macOS sets it.
Share history between windows Each window adds its commands to the history as they run and reads the others', so the Up Arrow finds them in every window.
Save when each command ran Each command is saved with the time it started and how long it ran, which history -iD shows.
Skip repeated commands When you run a command that is already in the history, the older copy goes, so each command appears once.
Leave out commands that start with a space A command typed after a space isn't saved, which keeps a password or token you type out of the history.
Remove extra spaces Spaces a command doesn't need are taken out before it is saved.
Check recalled commands first !! and the other history shortcuts put the command on the line for you to check, instead of running it at once.
Lock the history file safely Saving the history locks the file with the system's fcntl call instead of zsh's own locking, which zsh's manual says may be faster and avoids damage to a history kept on a network disk.
# Remember 50,000 commands
HISTSIZE=50000
SAVEHIST=50000

# Share history between windows
setopt SHARE_HISTORY

# Save when each command ran
setopt EXTENDED_HISTORY

# Skip repeated commands
setopt HIST_IGNORE_ALL_DUPS

# Leave out commands that start with a space
setopt HIST_IGNORE_SPACE

# Remove extra spaces
setopt HIST_REDUCE_BLANKS

# Check recalled commands first
setopt HIST_VERIFY

# Lock the history file safely
setopt HIST_FCNTL_LOCK

Typing

Setting What it does
Allow comments in commands A word that starts with # begins a comment that runs to the end of the line, as in a script, so a pasted command with comments runs.
Search history with the arrow keys Type the start of a command, and the Up Arrow and Down Arrow go only through the commands that start that way, whichever of its two sequences each arrow key sends (^[[A or ^[OA for the Up Arrow).
Delete paths one folder at a time Deleting a word back stops at each slash, so a path goes one folder at a time.
# Allow comments in commands
setopt INTERACTIVE_COMMENTS

# Search history with the arrow keys
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey '^[[A' up-line-or-beginning-search
bindkey '^[OA' up-line-or-beginning-search
bindkey '^[[B' down-line-or-beginning-search
bindkey '^[OB' down-line-or-beginning-search

# Delete paths one folder at a time
WORDCHARS=${WORDCHARS//[\/]}

Folders

Setting What it does
Go to a folder by typing its name Typing only a folder's name goes to it, as cd does.
Remember the folders you visit The folders you leave are remembered, each only once: dirs -v lists them, and cd +1, cd +2, and so on go back.
# Go to a folder by typing its name
setopt AUTO_CD

# Remember the folders you visit
setopt AUTO_PUSHD PUSHD_IGNORE_DUPS

Completion

Setting What it does
Choose completions from a menu When Tab finds several completions, it opens a menu you move through with the arrow keys.
Complete names in any case Tab completes a name whatever its case, so doc completes to Documents.

The completion settings also start zsh's completion system, once, which the first line does.

# Start the completion system once
(( $+functions[compdef] )) || { autoload -Uz compinit && compinit }

# Choose completions from a menu
zstyle ':completion:*' menu select

# Complete names in any case
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

Colors

Setting What it does
Show colors in ls ls shows folders, links, and programs in the Terminal theme's colors, as man ls describes CLICOLOR.
# Show colors in ls
export CLICOLOR=1

Git

Peel uses the Git in the developer folder xcode-select -p names, from the Command Line Tools or Xcode, or else Homebrew's, and offers only the settings that Git lists in git help --config. If Git isn't on your Mac, the Git tab gives xcode-select --install, Apple's command for the tools.

Pull and Push

Setting What it does
Rebase when pulling git pull puts your commits after what it fetched, instead of adding a merge commit.
Push new branches without setting them up git push on a new branch creates it on the remote and follows it, without --set-upstream.
Remove branches deleted on the remote git fetch removes its copies of the branches deleted on the remote, and your own branches stay.
Stash changes before a rebase A rebase puts uncommitted changes aside and brings them back when it ends.
# Rebase when pulling
git config --global pull.rebase true

# Push new branches without setting them up
git config --global push.autoSetupRemote true

# Remove branches deleted on the remote
git config --global fetch.prune true

# Stash changes before a rebase
git config --global rebase.autoStash true

Diffs and Merges

Setting What it does
Use the histogram diff Diffs first match the lines that appear rarely, so changes line up around them.
Color moved lines Lines that moved without changing get colors of their own in a diff.
Show the original in conflicts A conflict shows the lines as they were before both changes, between the two sides.
Reuse conflict resolutions Git remembers how you resolved a conflict and resolves the same conflict the same way next time.
# Use the histogram diff
git config --global diff.algorithm histogram

# Color moved lines
git config --global diff.colorMoved default

# Show the original in conflicts
git config --global merge.conflictStyle zdiff3

# Reuse conflict resolutions
git config --global rerere.enabled true

Branches

Setting What it does
Start new repositories on main git init names the first branch main.
List branches by latest commit git branch lists the branches with the most recent commit first.
Show lists in columns Commands such as git branch and git tag show their lists in columns when the window has room.
# Start new repositories on main
git config --global init.defaultBranch main

# List branches by latest commit
git config --global branch.sort -committerdate

# Show lists in columns
git config --global column.ui auto

Signing

Setting What it does
Sign commits with your SSH key Every commit is signed with your SSH key, and GitHub shows it as Verified once you add the key there as a signing key. Peel signs with the key Git already signs with when gpg.format is ssh, and otherwise with the first of id_ed25519.pub, id_ecdsa.pub, and id_rsa.pub in ~/.ssh; it offers the setting when it has such a key, or when signing is already on. Turning it off puts the three keys back as they were before Peel set them: a key Peel found already set stays, so signing you had with another format, such as GPG, goes on as before, and signing you set up yourself with an SSH key stops, as a setting you made yourself goes back to Git's default.
# Sign commits with your SSH key
git config --global gpg.format ssh
git config --global user.signingKey ~/.ssh/id_ed25519.pub
git config --global commit.gpgSign true

SSH

The two lines that make ssh read Peel's file go at the end of ~/.ssh/config. Match all comes first so they reach every server, even after a Host block:

Match all
  Include "~/Library/Application Support/Peel/Terminal/ssh_config"

Connections

Setting What it does
Keep key passphrases in your keychain ssh asks for a key's passphrase once, saves it in your keychain, and adds the key to the agent. UseKeychain is macOS's own, so Peel's file names it in an IgnoreUnknown line first, as Apple's note shows, and an ssh installed from elsewhere, such as Homebrew's, passes over it. An IgnoreUnknown your own ~/.ssh/config sets earlier wins, since ssh keeps the first value it finds.
Keep connections alive On a quiet connection, ssh checks on the server every minute, so a router doesn't drop it.
Reuse connections to a server A new connection to a server you're already connected to opens at once through the first, which stays open 10 minutes after the last one ends. Leave it off if you use two accounts on one server, such as two GitHub accounts: ssh would send the second through the first one's connection.

Without Peel, these lines can go at the end of ~/.ssh/config, in a Match all block of their own:

Match all
  # Keep key passphrases in your keychain
  IgnoreUnknown UseKeychain
  UseKeychain yes
  AddKeysToAgent yes

  # Keep connections alive
  ServerAliveInterval 60

  # Reuse connections to a server
  ControlMaster auto
  ControlPath ~/.ssh/cm-%C
  ControlPersist 10m

Tools

Peel installs nothing: each tool comes with its Homebrew command and the lines its own documentation gives, and a few of Peel's own, so the colors are the Terminal theme's (--color=16 for fzf, BAT_THEME=ansi for bat). If Homebrew isn't on your Mac, the Tools tab says so and gives the command from brew.sh. The lines below use $HOMEBREW_PREFIX, as most of Homebrew's own notes do: brew shellenv, which Homebrew's installer asks you to add to ~/.zprofile, sets it, and without it you write your Homebrew folder, /opt/homebrew or /usr/local, in its place. Peel writes your Mac's Homebrew folder there for you.

For the Shell

Tool What it does Install
zsh-completions Completions for many more commands. If zsh then warns about insecure folders, brew info zsh-completions says how to fix it. brew install zsh-completions
fzf-tab Tab completion in fzf, where typing narrows the list. It needs fzf, and its lines go after the completion system starts, which zsh-completions' lines or Peel's Completion settings do. Its menu no takes the place of Peel's menu. brew install fzf fzf-tab
zoxide z goes to a folder you use from part of its name, and zi lets you choose one in fzf. brew install zoxide
fzf Control-R searches your history, Control-T pastes files and folders, and Option-C, with Option as Meta, goes to a folder. --color=16 uses the Terminal theme's colors. brew install fzf
direnv Sets a project's environment variables in its folder, from its .envrc once you allow it with direnv allow. brew install direnv
zsh-autosuggestions Suggests the rest of a command from your history. brew install zsh-autosuggestions
zsh-syntax-highlighting Colors commands as you type them. brew install zsh-syntax-highlighting

Their lines go in ~/.zshrc in this order, zsh-completions' above Peel's line and the others below it, and zsh-syntax-highlighting's must be the last line. zoxide's and direnv's own pages ask for the end of ~/.zshrc too, zoxide's so that it comes after the completion system starts; here only zsh-autosuggestions' and zsh-syntax-highlighting's lines follow them. fzf's lines come after fzf-tab's: fzf takes Tab for its ** completion and hands every other Tab to fzf-tab.

# zsh-completions
FPATH="$HOMEBREW_PREFIX/share/zsh-completions:$FPATH"
autoload -Uz compinit && compinit

# fzf-tab
source "$HOMEBREW_PREFIX/opt/fzf-tab/share/fzf-tab/fzf-tab.zsh"
zstyle ':completion:*' menu no

# zoxide
eval "$(zoxide init zsh)"

# fzf
source <(fzf --zsh)
export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --color=16"

# direnv
eval "$(direnv hook zsh)"

# zsh-autosuggestions
source "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh"

# zsh-syntax-highlighting
source "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"

For Git

Tool What it does Install
delta Diffs with syntax highlighting and line numbers. brew install git-delta
Git LFS Works with repositories that keep large files in LFS. brew install git-lfs
lazygit A full Git interface inside Terminal: run lazygit in a repository. brew install lazygit

Then run these once in Terminal.

# delta
git config --global core.pager delta
git config --global interactive.diffFilter 'delta --color-only'
git config --global delta.navigate true
git config --global delta.line-numbers true

# Git LFS
git lfs install

For Every Day

Tool What it does Install
bat Shows files with syntax highlighting, and colors manual pages. brew install bat
hyperfine Measures how long commands take, such as hyperfine "zsh -i -c exit" for a new shell. brew install hyperfine
tlrc Short, practical examples for a command: tldr followed by its name. brew install tlrc

bat's lines go in ~/.zshrc. bat's README now gives another MANPAGER line; Peel's, which it gave before, runs col -bx first because macOS's man marks bold text with backspaces, which bat would show as they are.

# bat
export BAT_THEME=ansi
export MANPAGER="sh -c 'col -bx | bat -l man -p'"

Where the colors come from

Tapetum icon: a fan of color swatches

Tapetum

The palettes of these themes come from Tapetum, a free theme pack for VS Code and the editors built on it, by Țugui Dragoș: 58 themes in 28 families, each in dark and light, plus a high contrast pair for Coherence, with every color placed by hand and its contrast measured on the surface it sits on.

Install Tapetum from the Visual Studio Marketplace Install Tapetum from Open VSX Tapetum on GitHub