One-click dev environment setup for Linux / macOS. Default shells: bash + zsh (Oh My Zsh); Fish is optional (see below). Also vimrc, tmux, etc.
- Linux (Ubuntu / Debian / Fedora) and macOS
- Configs managed via symlinks; edits stay in repo for backup and version control
- One-shot or selective install;
--yesfor non-interactive mode;--forceto re-run / reinstall - macOS: declarative
common/Brewfile+ optionalcommon/Brewfile.optional;--new-mac/--new-linuxfor new-machine checks - Mainland China mirrors (Go / Node / uv / npm / Cargo) via
config/mirrors.bash+ linked~/.npmrc/~/.cargo/config.toml - Profile presets: C++, Python, AI Infra (LLVM / MLIR); optional Triton (GPU kernel) via
config/triton.bash - One env file:
config/resetrc.bashholds all shared env as# SECTION: …blocks (nvm, pyenv, CUDA, LLVM, …). Edit that file to affect bash, zsh, and profiles; optional Fish uses the same file viaemit_fish_env.bashwhen linked.
What touches the system
- Only
$HOME(and standard XDG paths) are modified by default, viacommon/link.ini→create_links.sh: symlinks such as~/.bashrc,~/.zshrc,~/.my-utils.env,~/.shell_init.bash, etc. Fish symlinks are commented out inlink.iniuntil you opt in. - Shell env logic lives entirely under the cloned repo (
config/resetrc.bash,shell_init.bash, …). No/etcpatches are required for this dotfiles layout. Proxy helpers only set session env vars (never/etc/apt). - Linux packages (
apt/dnf/yum) still need sudo insidecommon/install_packages.sh. Opt out withMY_UTILS_ALLOW_SUDO=offin~/.env.rc(skips those installs; Homebrew on macOS is unaffected). Metadata refresh only — never a full-systemyum/dnf update -y. common/misc.shdoes not invoke sudo. Missing git/fzf/node on Linux → run packages first.chsh→ zsh is opt-in:MY_UTILS_CHSH=1in~/.env.rc.
Multi-OS
- Packages:
common/install_packages.sh+common/deb_app_list.ini/common/Brewfile(macOS; falls back tocommon/mac_app_list.txt) /common/rpm_app_list.ini. Already-installed packages are skipped unless--force. Optional GUI/mas set:common/Brewfile.optional. WSL skips unavailablelinux-headers-*. - Env:
config/resetrc.bashuses_is_linux/_is_macosinside sections (PATH, CUDA, brew kegs, …). Mainland mirrors:config/mirrors.bash(default on;MY_UTILS_MIRRORS=offin~/.env.rcto disable). Proxy:config/proxy.bash— default off;MY_UTILS_PROXY=oninconfig/env.rcto enable. Claude Code + Codex shell BYOK lives inconfig/env.rc(template:config/env.rc.example). Hermes agent keys stay in~/.hermes/.env(private git; untouched). Never commit plaintextconfig/env.rc— sync viaprivacy/env.rc.enconly.
Multi-shell
- bash / zsh (default): One
resetrc.bash(bash-compatible);config/shell_init.bashloadsbash_interactive.bashorconfig/zsh_entry.zsh(Oh My Zsh), thenresetrc+optional_home.bash. - fish (optional): Install
fishyourself (apt/brew/…), uncomment the Fish lines incommon/link.ini, run./bootstrap.sh --tools links --yes. Thenconfig/emit_fish_env.bash+config/fish/my-utils.fishimport exported variables fromresetrc; aliases/functions are not auto-ported.
Gaps (by choice)
- Login-only sessions that never source
~/.bashrc/~/.zshrcwon’t load my-utils unless you add a one-liner to~/.profileor~/.zprofilepointing atshell_init/resetrc—not linked by default to keep the installer conservative.
中文概要: 默认 packages 只装 zsh(含 Oh My Zsh 相关),不装 Fish;Fish 相关 symlink 在 link.ini 里默认注释。Linux 装包才用 sudo(可用 MY_UTILS_ALLOW_SUDO=off 关闭);misc 不 sudo;chsh 需 MY_UTILS_CHSH=1 才改登录 shell。
git clone https://github.com/blueyi/my-utils.git ~/workspace/my-utils
cd ~/workspace/my-utils
./myu help # unified CLI (short for my-utils)
# One-shot init (no prompts): packages, links, misc, vimrc, cursor
./myu setup --yes
# same as: ./bootstrap.sh --yes
exec $SHELL# 1) Xcode CLT (if needed)
xcode-select --install
# 2) Sign in to the Mac App Store (required for Brewfile `mas` entries)
# 3) Clone and bootstrap
git clone https://github.com/blueyi/my-utils.git ~/workspace/my-utils
cd ~/workspace/my-utils
./myu setup --new-mac --yes
# Optional extra apps (discord, lark, Telegram, …):
./myu packages --optional --yes
# Privacy vault (prompt for password ≥8 chars; decrypt privacy/*.enc):
# ./myu vault restore
# Re-run is safe: successful tools and already-installed packages are skipped.
# Force a full redo:
./myu setup --new-mac --force --yes
exec $SHELL# Needs sudo for apt/dnf/yum (packages step)
git clone https://github.com/blueyi/my-utils.git ~/workspace/my-utils
cd ~/workspace/my-utils
./myu setup --new-linux --yes
# Force a full redo:
./myu setup --new-linux --force --yes
exec $SHELLEdit common/Brewfile for the core macOS set; put extras in common/Brewfile.optional. Changing either file (when used) invalidates the packages stamp. Changing common/link.ini invalidates the links stamp so new symlinks (e.g. npmrc / cargo) apply on the next --yes.
Default on after links + shell init:
- Env: Go / Node dist / Electron / uv Python →
config/mirrors.bash - Files:
~/.npmrc→config/npm/npmrc;~/.cargo/config.toml→config/cargo/config.toml
Disable env mirrors: export MY_UTILS_MIRRORS=off in ~/.env.rc. Unlink the two files to fully revert npm/Cargo registries.
Preferred entry: ./myu (short for my-utils). bootstrap.sh still works as the underlying runner.
./myu help
./myu setup --yes # packages links misc vimrc cursor
./myu packages --yes
./myu packages --optional --yes
./myu links --force --yes
./myu vault backup # encrypt → privacy/*.enc
./myu vault restore # decrypt (password prompt, ≥8 chars)
./myu setup --new-mac --yes # macOS: includes vault restore
./myu setup --new-linux --yes # Linux: includes vault restore
./myu hexo --yes # opt-in Hexo (not in default setup)
./myu setup --tools packages links misc hexo --yes
# Equivalent low-level:
./bootstrap.sh --tools env --yes
./bootstrap.sh --tools vault-backup --yesIdempotency: successful tools write stamps under ~/.local/state/my-utils/bootstrap/. Later runs skip those tools unless --force. packages also re-runs when Brewfile (+ optional, if used) changes; links re-runs when link.ini changes. Within packages, already-installed apt/yum/brew packages are skipped unless --force (then reinstall).
~/.vimrc, ~/.bashrc, ~/.zshrc symlink to files under config/. ~/.p10k.zsh → config/p10k.zsh (Powerlevel10k; edit in repo, re-run links if needed). ~/.bashrc / ~/.zshrc end with source ~/.shell_init.bash, which runs config/shell_init.bash: zsh → Oh My Zsh + p10k + resetrc.bash; bash → interactive defaults + resetrc.bash. All shared env lives in config/resetrc.bash as ordered # SECTION: … blocks (proxy, PATH, nvm, pyenv, zsh-only OpenClaw/fzf, CUDA, LLVM, …). Zsh-only bits are guarded with ZSH_VERSION inside that file.
config/
├── _vimrc, _bashrc, _zshrc → ~/.vimrc, ~/.bashrc, ~/.zshrc
├── p10k.zsh → ~/.p10k.zsh (Powerlevel10k theme)
├── shell_init.bash → ~/.shell_init.bash
├── resetrc.bash # monolithic env (comment sections; search SECTION:)
├── mirrors.bash # Mainland China env mirrors (GOPROXY, NODEJS_ORG_MIRROR, …)
├── npm/npmrc → ~/.npmrc
├── cargo/config.toml → ~/.cargo/config.toml
├── zprofile.brew.bash # reference snippet; misc appends brew shellenv to ~/.zprofile
├── sections/README.md # pointer only (old split layout archived in deprecated/)
├── bash_interactive.bash # bash-only prompt, completion
├── zsh_entry.zsh # Oh My Zsh + theme/plugins, then resetrc
├── path.bash, cmake_env.bash # thin → resetrc (IDE one-liners)
├── emit_fish_env.bash, fish/my-utils.fish # optional Fish; symlink via commented lines in link.ini
├── triton.bash # optional GPU/Triton layer on top of resetrc
├── deprecated/ # archive (see deprecated/README.md)
└── ...
Not installed or linked by default. Steps: sudo apt install fish (or brew install fish) → uncomment the two Fish lines in common/link.ini → ./bootstrap.sh --tools links --yes. Then Fish loads my-utils.fish, which runs emit_fish_env.bash to mirror resetrc.bash + optional_home.bash exports. For pyenv in Fish, see pyenv init - fish upstream.
# Preset profiles (manual source)
source ~/repos/my-utils/profiles/cpp/env.bash # C++ / LLVM
source ~/repos/my-utils/profiles/python/env.bash # Python
source ~/repos/my-utils/profiles/ai_infra/env.bash # AI Infra
# Triton (GPU kernel) dev
source "$MYRC_PATH/triton.bash"If you see:
CMake was unable to find a build program corresponding to "Ninja"CMAKE_C_COMPILER not set/CMAKE_CXX_COMPILER not set
Quick fix (any terminal, including Cursor/IDE): source the CMake env script before running cmake so PATH, CC, CXX, and CMAKE_MAKE_PROGRAM are set:
# Replace with your actual my-utils path if different
source ~/workspace/my-utils/config/cmake_env.bash
# or, if MY_UTILS_ROOT is already set:
source "$MY_UTILS_ROOT/config/cmake_env.bash"
cd /path/to/your/project/build
cmake ..macOS:
-
PATH: Homebrew and baseline paths are set in
config/resetrc.bashwhen you use the linked rc. If your terminal didn’t load it (e.g. Cursor’s built-in terminal), use thesource .../config/cmake_env.bashone-liner above (it sourcesresetrc.bash). -
C/C++ compiler: Install Xcode Command Line Tools so
clangis available:xcode-select --install
Linux (apt): Install packages with ./bootstrap.sh --tools packages --yes. If the terminal didn’t load your rc, run source .../config/cmake_env.bash before cmake.
Interactive git is always the real git (never wrapped). Dual-remote lives only in gdr.
When GitHub is slow/blocked and you keep a GitCode mirror under the same namespace (blueyi/…):
git pull -r # native git
gdr pull -r # dual: pull origin; on timeout → gitcode
gdr push # push GitHub then GitCode (OK if either succeeds)
gdr fetch origin
gdr clone git@github.com:blueyi/foo.git
gdr setup # wire origin + gitcode remotes for current repo
gdr setup --scan ~/workspace/reposgdr lives at common/gdr (MY_BIN / common/ is on PATH after shell init). Defaults: config/git-dual-remote.env.
Password-encrypt machine-local secrets into privacy/*.enc, commit ciphertext to GitHub, and restore on a new machine after clone.
| Command | Purpose |
|---|---|
./myu vault backup |
Encrypt paths in privacy/manifest |
./myu vault restore |
Decrypt into $HOME (prompts if SYNC_ENV_KEY unset) |
./myu vault encrypt -i SRC -o DST.enc |
Encrypt one file |
./myu vault decrypt -i SRC.enc [-o DST] |
Decrypt one file (stdout if -o omitted) |
./myu setup --new-mac / --new-linux |
Bootstrap + restore at the end |
# Old machine (batch)
./myu vault backup
git add privacy/*.enc privacy/manifest && git commit -m "Update privacy vault" && git push
# Single file
./myu vault encrypt -i ~/.ssh/config -o privacy/ssh-config.enc
./myu vault decrypt -i privacy/ssh-config.enc -o ~/.ssh/config
# New machine
./myu vault restorePassword: SYNC_ENV_KEY or interactive prompt, ≥8 characters. Crypto: OpenSSL AES-256-CBC + PBKDF2. Edit privacy/manifest (name|mode|path). Modes: file, env-merge. Paths may be ~/… or repo-relative (e.g. config/env.rc).
~/.env.rc layout: plaintext lives at config/env.rc (gitignored); common/link.ini symlinks ~/.env.rc → that file. Commit only privacy/env.rc.enc. New machine: ./myu vault restore refreshes links; if env.rc restore fails, an empty config/env.rc stub is created so the symlink still works.
Sync Cursor settings to cursor_bak/ and use symlinks so edits stay in the repo. Backed up (macOS: ~/Library/Application Support/Cursor, Linux: ~/.config/Cursor):
- User/ – settings.json, keybindings.json, mcp.json, snippets, etc.
- Preferences – app-level preferences file
- ide_state.json – when present
- ~/.cursor/rules →
cursor_bak/rules - ~/.cursor/projects →
cursor_bak/projects(per-workspace state;terminals/,agent-transcripts/,assets/chat screenshots,mcps/schema caches,tmp-*, andcanvases/{node_modules,tsconfig.json}are gitignored — user MCP config is inUser/mcp.json)
Included in default tool list (both ./bootstrap.sh --yes and interactive ./bootstrap.sh will include cursor unless you use --tools to limit):
./bootstrap.sh --yes # runs cursor step with others
./bootstrap.sh --tools cursor --yes # only Cursor config link
./bootstrap.sh --tools cursor # interactive: ask then link
# Standalone:
./common/cursor_config_link.sh # Link
./common/cursor_config_link.sh --restore # Restore original pathsMIT