Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

بسم الله الرحمن الرحيم

Dot-Zsh

An extremely opinionated set of Zsh scripts, app configs, and their setup, that I rely on on macOS & brew for general computing and web development...

The repo is split into:

  1. Environment setup
  2. Inlined aliases
  3. Functioned commands
  4. Full script files
  5. Linked app configs (configs/)

Setup

  1. Keep this repo at a stable path (example):

    ~/Code/Scripts/CLI_MACOS_dot-zsh
  2. Install dependencies via Homebrew (see Dependencies):

    brew bundle --file ~/Code/Scripts/CLI_MACOS_dot-zsh/Brewfile
  3. Source all command layers in your ~/.zshrc:

    DOTZSH="$HOME/Code/Scripts/CLI_MACOS_dot-zsh"
    [ -f "$DOTZSH/.zsh_env" ] && source "$DOTZSH/.zsh_env"
    [ -f "$DOTZSH/.zsh_aliases" ] && source "$DOTZSH/.zsh_aliases"
    [ -f "$DOTZSH/.zsh_functions" ] && source "$DOTZSH/.zsh_functions"
    [ -f "$DOTZSH/.zsh_scripts" ] && source "$DOTZSH/.zsh_scripts"
    unset DOTZSH

    [!CAUTION] Watch out for the spacing needed for Github README when you copy!

  4. Ensure script files are executable:

    chmod +x ~/Code/Scripts/CLI_MACOS_dot-zsh/scripts/*.sh
  5. Symlink the app configs you want (see Linked App Configs). Example (mise):

    mv ~/.config/mise ~/Code/Scripts/CLI_MACOS_dot-zsh/configs/mise
    ln -s ~/Code/Scripts/CLI_MACOS_dot-zsh/configs/mise ~/.config/mise
  6. Reload shell:

    source ~/.zshrc

Dependencies

  • mise: runtime manager for node/php/pnpm/python/etc. Install via curl https://mise.jdx.dev/install.sh | sh — not Homebrew, which installs to the wrong path for .zsh_env's activation line.
  • rustup: Rust toolchain manager. Install via curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh — not Homebrew. Rust itself is normally pinned per-project as a mise tool (rust = "<version>" in the repo's .mise.toml), but mise's rust backend resolves through an existing rustup install, and rustup remains the documented fallback when mise isn't available. It owns ~/.cargo + ~/.rustup and appends . "$HOME/.cargo/env" to ~/.zshenv (the one PATH line this repo doesn't hold, since it must apply to non-interactive shells too).
  • Claude Code: install via the native installer, curl -fsSL https://claude.ai/install.sh | bash — not Homebrew. It lands as an auto-updating ~/.local/bin/claude (.zsh_env prepends that dir to PATH); the Homebrew cask lags behind it. Codex stays a cask in the Brewfile. Both run inside Orca, which injects its own hooks into configs/claude/settings.json and ~/.codex/hooks.json.
  • specify-cli: Spec Kit's CLI, used by the Rust/Laravel workspaces' .specify/ trees. A uv tool on this machine, not a project dependency: uv tool install specify-cli.
  • sccache: shared Rust compile cache. .zsh_env exports RUSTC_WRAPPER=sccache only when the binary exists, so cargo never breaks without it; the Rust workspaces force CARGO_INCREMENTAL=0, which is exactly the case sccache helps.
  • Language servers for Claude Code's LSP plugins (typescript-lsp, php-lsp, rust-analyzer-lsp from the official marketplace) — typescript-language-server, typescript, intelephense — are mise global tools (npm: backend in configs/mise/config.toml), not Homebrew; rust-analyzer comes with rustup.
  • just: command runner for the Justfile recipes Rust/Node workspaces use (just build, just test, just lint). In the Brewfile — don't cargo install it, or you end up with a second copy in ~/.cargo/bin.
  • cmake + ninja: native build toolchain for Rust/Tauri workspaces that compile C/C++ dependencies.
  • actionlint: static analysis for GitHub Actions workflows.
  • nasm: assembler some Rust crates' build scripts need.
  • Windows cross-builds (NSIS installers from macOS): llvm (clang-cl, llvm-rc, llvm-ar), lld (lld-link), and makensis, driven by cargo-xwin — a cargo tool, cargo install --locked cargo-xwin, not a formula. Homebrew keeps llvm off PATH so Apple's clang stays the default; build scripts prepend brew --prefix llvm themselves.
  • llama.cpp: local model provider (llama-server, llama-cli).
  • ocrmypdf + tesseract: OCR tooling for PDF fixtures and comparisons.
  • flyctl: Fly.io deploys.
  • scrcpy + android-platform-tools (adb): Android phone mirroring over USB or Wi-Fi. This is the only mobile tooling kept; the SDK/NDK/JDK/Xcode toolchain is parked in ARCHIVE.md. adb's pairing keys live in ~/.android.
  • ffmpeg: powers the vid-* scripts.
  • aria2: powers download.
  • Some CLI tooling used by the shell and coding-agent workflow...
  • python3 + openpyxl: for unicode-csv (auto-installs openpyxl).
  • OrbStack: Docker engine and Compose runtime for the Harnesser and sightmark Docker setups.
  • imagemagick: native library used when the mise PHP source build installs imagick/imagick through PIE.
  • Window manager stack (install docs): Karabiner-Elements, yabai, skhd, SketchyBar, Hammerspoon (SketchyBar requirement) — fonts/icons: Hack Nerd Font, SF Symbols.

Everything above except mise, rustup, Claude Code, specify-cli, and language-level packages is covered by brew bundle --file Brewfile.

[!NOTE] scripts/*.sh keep #!/usr/bin/env bash shebangs and run fine on macOS's stock bash 3.2 — they're separate processes, unaffected by your login shell.

0) Environment Setup (.zsh_env)

Sourced first — activates tool managers, sets env vars the other layers may need.

  • mise activate zsh
  • $HOME/.composer/vendor/bin on PATH for global Composer tools such as laravel/installer (composer global require laravel/installer once mise PHP is available)
  • compinit (loads completions, including OrbStack's, added to fpath by ~/.zprofile)

1) Inlined Aliases (.zsh_aliases)

Direct aliases, no function wrapper.

System

  • logout: logs out via osascript.
  • reboot: confirms, then sudo reboot.
  • update: Homebrew update/upgrade/cleanup, then softwareupdate -l.

Git

  • oops: pull current branch with rebase from origin/<current-branch>.
  • chest: stash including untracked files (git stash push -u).
  • grit: merge origin/dev using -X theirs strategy option.
  • maiv: hard reset to origin/main then force-push with lease.
  • nometa: disable executable-bit tracking (core.fileMode false).

Warning

maiv is destructive (git reset --hard + force push). Use only to intentionally discard local divergence.

AI

  • codex: codex --yolo.
  • clodex: claude --dangerously-skip-permissions.

2) Functioned Commands (.zsh_functions)

Real shell functions for argument-aware or multi-step behavior.

System

  • own [path]: recursive chown to current user/group (defaults to current directory).
  • shutdown [args...]: confirms, then sudo shutdown "$@".
  • wholecleanup: empties Trash, cleans Homebrew/npm/pnpm caches, clears Helium browser cache, deletes leftover installers in ~/Downloads. Prints disk usage before/after.

Git

  • girm <path>: git rm -r --cached for tracked file/dir untracking.
  • oopsie: pull-rebase current branch, rebase onto origin/main, then force-push with lease.

Tip

Use oops when your push is rejected because the remote branch moved. Use oopsie when your branch is stale against main and needs a clean rebase before a PR — it rewrites history, so avoid it on shared branches.

Tools

  • download <url...>: aria2c with aggressive segmented download flags.

3) Full Script Files (.zsh_scripts -> scripts/*.sh)

Aliases to standalone scripts, resolved relative to $HOME/Code/Scripts/CLI_MACOS_dot-zsh/scripts.

Arabic

  • aranum: convert Western digits <-> Arabic-Indic digits.
    • Example: aranum 1234 -> ١٢٣٤
  • arastrip: removes harakat/combining marks and normalizes ٱ to ا.
    • Example: arastrip "أَيُّ سَمَاءٍ تُظِلُّنِي، أَوْ أَيُّ أَرْضٍ تُقِلُّنِي، إِنْ أَنَا قُلْتُ فِي كِتابِ اللَّهِ مَا لَا أَعْلَمُ؟" -> أي سماء تظلني، أو أي أرض تقلني، إن أنا قلت في كتاب الله ما لا أعلم؟

Media (FFmpeg)

  • vid-combine <file1..|list.txt> <output.mp4>: concatenates clips with timestamp normalization.
  • vid-compress [-1080|-720] [-lq] <input> [output]: H.265 compression with optional downscale and lower quality mode.
  • vid-eq-audio <input> [output]: denoise/EQ/loudness-normalized audio track.
  • vid-extract-audio <input> [start] [end] [output.mp3]: extracts audio (supports flexible timestamps).
  • vid-extract-video <input> [start] [end] [output.mp4]: extracts video segment with re-encode.
  • vid-pic <file|dir> [output_dir]: robust thumbnail generator with fallback strategies.
  • vid-trim <input> [start] [end] [output]: trims with inclusive end handling and safe output flags.

Utilities

  • unicode-csv <folder|file.csv>: CSV -> XLSX converter (auto-detects encoding/delimiter, RTL sheet formatting).
  • anyurl <url>: strips protocol, www., and trailing slash.

Linked App Configs (configs/)

Real config files for a few apps live under configs/; their actual system paths are replaced with symlinks pointing back here, so this repo stays the single source of truth. Apps whose config directory only holds harmless local cruft (backups, caches) get the whole folder symlinked, with that cruft gitignored. Apps whose directory holds live credentials or session data (.codex, .claude) get only the one specific file linked, so that data never enters the repo at all.

App Install Symlinked as
Karabiner-Elements in Brewfile ~/.config/karabiner -> configs/karabiner
yabai in Brewfile ~/.config/yabai -> configs/yabai
skhd in Brewfile ~/.skhdrc -> configs/skhd/skhdrc
SketchyBar in Brewfile ~/.config/sketchybar -> configs/sketchybar
mise curl https://mise.jdx.dev/install.sh | sh (not in Brewfile) ~/.config/mise -> configs/mise
Codex CLI in Brewfile ~/.codex/config.toml only
Claude Code native installer (not in Brewfile) ~/.claude/settings.json only
Git ships with Xcode Command Line Tools ~/.gitconfig -> configs/git/gitconfig
Hammerspoon in Brewfile ~/.hammerspoon/init.lua + sketchybar-scroll.lua only
OBS in Brewfile ~/Library/Application Support/obs-studio -> configs/obs (only scenes, profiles, and user.ini are tracked)
Agent skills npx skills ~/.agents/.skill-lock.json -> configs/agents/skill-lock.json

Two more aren't symlinks, because macOS's preferences system replaces linked plists:

  • AltTab: configs/alt-tab/sync.sh export saves its settings to configs/alt-tab/settings.plist; sync.sh import applies them (quits and relaunches AltTab).
  • macOS system settings: configs/macos/defaults.sh applies the Dock, Spaces, Stage Manager, menu bar, trackpad, and Finder settings the window-manager setup expects. It also lists the manual steps (SIP, permissions).

To adopt a new machine: install the app, mv the real file/dir into the matching configs/<app>/ path, ln -s it back.

The window-manager setup uses a locally patched SketchyBar for selective click-through and native workspace highlighting. See window-management setup, verification, and rollback.

macOS App Stack

The rest of my opinionated macOS setup, all in the Brewfile except Orca and Hush (installed from their GitHub releases). Apps I uninstalled only to free disk space are parked in ARCHIVE.md.

Essentials

Productivity

Raycast Extensions

  • Adhan Time
  • Hijri Converter
  • Arabic Helpers
  • Change Case
  • Lorem Ipsum
  • Ruler
  • Color Picker
  • Image Modification
  • QR Code Scanner
  • Brew
  • Mole
  • Tailwind CSS
  • Kill Process
  • App Cleaner

Development


والحمد لله رب العالمين

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages