A universal macOS clipboard utility built for Zsh that bridges the gap between running terminal commands and sharing outputs.
By appending | c to any command, it streams the output live to your console screen while simultaneously generating a beautifully structured, distinct text block on your macOS system clipboard. It works identically in the native Mac Terminal, iTerm2, and VS Code's integrated terminal.
Simply attach | c to the end of your standard terminal workflow:
# Capture regular command output
sw_vers | c
# Capture commands that include errors (redirects stderr to stdout)
curl https://invalid-url.xyz 2>&1 | cWhen you paste your clipboard (into Slack, GitHub, Notion, or an email), it will be formatted cleanly like this:
=== Copy Command: COMMAND ===
\$ sw_vers
=== Copy Command: OUTPUT ===
ProductName: macOS
ProductVersion: 14.5
BuildVersion: 23F79
=== Copy Command: END ===
If you just want the tool quickly without managing extra files, paste the code inside c_pipe.zsh directly into the bottom of your ~/.zshrc file.
If you manage your configuration using a dotfiles repository or a custom functions folder:
- Clone or save this directory into your custom configuration path (e.g.,
~/.config/zsh/functions/c_pipe/). - Add the following safety check to your primary
~/.zshrcfile to source it automatically:
# Replace the path below with the location where you saved the directory
export USER_FUNCTIONS_DIR="\$HOME/.config/zsh/functions"
if [ -f "\$USER_FUNCTIONS_DIR/c_pipe/c_pipe.zsh" ]; then
source "\$USER_FUNCTIONS_DIR/c_pipe/c_pipe.zsh"
fi- Restart your terminal or run
source ~/.zshrcto activate.
- Smart Markdown Auto-Wrapping: Automatically wrap the captured payload inside markdown code blocks (```bash) for instant, syntax-highlighted pasting on Slack or GitHub.
- Automated Data Scrubbing: Use regex filters to automatically detect and replace sensitive text strings (like GitHub tokens, AWS keys, or passwords) with a
[REDACTED]placeholder before it hits the clipboard.