Mac OS - Aliases Management#
Keep Mac Studio and MacBook Air in Sync
The Mac Studio is the source of truth for the shared aliases. Edit and publish changes there, then pull them onto the MacBook Air.
On the Mac Studio — edit and publish:
nano ~/Scripts/MacOS/Aliases/MacOS-Aliases.zsh source ~/.zshrc pushscripts
pushscriptscommits and pushes pending changes in the~/Scriptsrepository.On the MacBook Air — download and apply:
pullscripts source ~/.zshrcIf an open terminal still shows old aliases, open a new terminal window. The shared aliases are in
~/Scripts/MacOS/Aliases/MacOS-Aliases.zsh;~/.zshrcis local to each Mac and must source that file.Set up a rebuilt Mac: Clone the repository with
git clone git@github.com:marcoue/Scripts.git ~/Scripts, then restore the private~/.zshrcsettings from the 1PasswordHomelabvault entryMac OS .zshrc file. Ensure it sources the shared alias file, then runsource ~/.zshrc.Related guides: Mac OS - Recovery · Mac OS - Brewfile · Scripts Mangement.
1. Overview & Architecture#
This note outlines the strategy for version-controlling and managing macOS shell aliases and environment paths. By separating configuration logic from local secrets, you can track your entire command shortcut suite in version control while keeping sensitive credentials secure.
1.1 The Split-Profile Architecture#
To protect sensitive API tokens while version-controlling workflow paths, the shell configuration is split into two files:
- Tracked Configuration (
~/Scripts/MacOS/Aliases/MacOS-Aliases.zsh):- Managed inside your existing
ScriptsGit repository. - Pushed to GitHub and auto-mirrored to your UNAS-Pro NAS.
- Houses all custom aliases (
pushlab,pulllab,pushbrew,kvm, etc.) and system environment paths.
- Managed inside your existing
- Local Profile (
~/.zshrc):- Kept local-only and untracked (excluded from Git).
- Houses private system keys and service account tokens.
- Automatically sources the tracked aliases file at startup.
2. Tracked Configurations (~/Scripts/MacOS/Aliases/MacOS-Aliases.zsh)#
All non-sensitive command aliases, system paths, and environment settings are migrated to the central scripts repository.
The file is managed directly in version control at ~/Scripts/MacOS/Aliases/MacOS-Aliases.zsh. The local ~/.zshrc profile is maintained separately and restored manually from the 1Password entry documented below; no restore script is required.
2.1 Active Aliases Reference#
Here is a quick reference table of all active shell aliases managed in your environment:
Backup & Sync#
| Alias | Command / Execution | Description |
|---|---|---|
pushlab |
bash ~/Scripts/MacOS/sync-obsidian-homelab-hugo.sh |
Syncs local Obsidian Homelab notes and images to Proxmox VM, builds Hugo site, and backs up vault to GitHub. |
pulllab |
bash ~/Scripts/MacOS/pull-obsidian-homelab.sh |
Resets the vault to origin/main; prompts with [Y/n] only when uncommitted changes are present, including untracked files, and refuses to run while Obsidian is open. |
pushdash |
bash ~/Scripts/MacOS/sync-obsidian-dashapps-hugo.sh |
Syncs DashApps vault notes and images to HP1Docker, converts and builds Hugo, pushes changed website source to GitHub for Cloudflare Pages deployment, then backs up Notes/Images to the DashApps vault repository. Accepts --sync-only or --build-only. |
testdash |
bash ~/Scripts/MacOS/sync-obsidian-dashapps-hugo-preview.sh |
Syncs DashApps notes and images, then runs the server converter so the LAN Hugo preview updates; does not build, commit, or push. |
pushxgen |
bash ~/Scripts/MacOS/push-xcode-gendash.sh |
Stages local Xcode GenDash changes, commits them when present, and pushes origin/main. |
pullxgen |
bash ~/Scripts/MacOS/pull-xcode-gendash.sh |
Fetches and force-aligns the Xcode GenDash project with origin/main, prompting before overwriting local changes and refusing to run while Xcode is open. |
pushxgps |
bash ~/Scripts/MacOS/push-xcode-gpsdash.sh |
Stages local GPSDash Xcode changes, commits them when present, and pushes origin/main. |
pullxgps |
bash ~/Scripts/MacOS/pull-xcode-gpsdash.sh |
Fetches and force-aligns the GPSDash Xcode project with origin/main, prompting before overwriting local changes and refusing to run while Xcode is open. |
pushscripts |
cd ~/Scripts && git add . && git commit -m "Update scripts" && git push origin main |
Stages, commits, and pushes all changes in ~/Scripts/ to GitHub and NAS mirror. |
pullscripts |
cd ~/Scripts && git pull origin main |
Pulls latest commits from GitHub to update local scripts repository. |
pushmcp |
pushmcp() function (see §2.2) |
Stages the selected MCP master files, commits changes when present, triggers compilation through the MCP repository post-commit hook, and pushes ~/.mcp-config to GitHub. |
pullmcp |
(cd "$HOME/.mcp-config" && git pull origin main) |
Pulls the MCP master repository; its post-merge hook then recompiles all client configurations. |
pushbrew |
brew bundle dump --file=~/Scripts/MacOS/Brew/Brewfile --force && (cd ~/Scripts && git add MacOS/Brew/Brewfile && git commit -m "Auto-update Brewfile" && git push origin main) |
Dumps Homebrew package inventory (Brewfile) and commits/pushes it to remote repo. |
pullbrew |
(cd ~/Scripts && git pull origin main) && brew bundle --file=~/Scripts/MacOS/Brew/Brewfile ... |
Pulls updates, installs missing packages from Brewfile, and interactively prompts for cleanup. |
Utility & Workflows#
| Alias | Command / Execution | Description |
|---|---|---|
convert |
bash ~/Scripts/MacOS/convert_images_900.sh |
Scales local images down to 900px width. |
convertsend |
bash ~/Scripts/MacOS/convert_raw_send_to_vm.sh |
Processes RAW images and uploads them directly to Proxmox VM. |
speed |
bash ~/Scripts/MacOS/speed_test.sh |
Runs network diagnostic speed checks. |
gitstatus |
python3 ~/Scripts/MacOS/git_status.py |
Scans all Git repositories on the workstation and prints status summary. |
kvm |
~/Scripts/MacOS/KVM-Launch.sh |
Opens Java Web Start utility to control Tripp Lite KVM switch. |
netbox |
env -u OP_SERVICE_ACCOUNT_TOKEN python3 ~/Scripts/Linux/Netbox/Netbox_sync_gsheets_to_netbox.py |
Syncs homelab inventory from Google Sheets to NetBox using the personal 1Password session. |
GenDash File Locking#
| Alias | Command / Execution | Description |
|---|---|---|
genl |
~/Scripts/MacOS/lock_gendash.sh lock |
Locks GenDash files. |
genu |
~/Scripts/MacOS/lock_gendash.sh unlock |
Unlocks GenDash files. |
gens |
~/Scripts/MacOS/lock_gendash.sh status |
Checks GenDash file lock status. |
genx |
~/Scripts/MacOS/lock_gendash.sh lock-strings |
Locks resource string assets. |
GPSDash File Locking#
| Alias | Command / Execution | Description |
|---|---|---|
gpsl |
~/Scripts/MacOS/lock_gpsdash.sh lock |
Locks GPSDash localization worksheets and string catalog. |
gpsu |
~/Scripts/MacOS/lock_gpsdash.sh unlock |
Unlocks GPSDash localization worksheets and string catalog. |
gpss |
~/Scripts/MacOS/lock_gpsdash.sh status |
Checks GPSDash file lock status. |
gpsx |
~/Scripts/MacOS/lock_gpsdash.sh lock-strings |
Leaves localization worksheets unlocked and locks the GPSDash string catalog. |
SoundDash File Locking#
| Alias | Command / Execution | Description |
|---|---|---|
sndl |
~/Scripts/MacOS/lock_sounddash.sh lock |
Locks SoundDash localization worksheets and string catalog. |
sndu |
~/Scripts/MacOS/lock_sounddash.sh unlock |
Unlocks SoundDash localization worksheets and string catalog. |
snds |
~/Scripts/MacOS/lock_sounddash.sh status |
Checks SoundDash file lock status. |
sndx |
~/Scripts/MacOS/lock_sounddash.sh lock-strings |
Leaves localization worksheets unlocked and locks the SoundDash string catalog. |
DockDash File Locking#
| Alias | Command / Execution | Description |
|---|---|---|
docl |
~/Scripts/MacOS/lock_dockdash.sh lock |
Locks DockDash localization worksheets and string catalog. |
docu |
~/Scripts/MacOS/lock_dockdash.sh unlock |
Unlocks DockDash localization worksheets and string catalog. |
docs |
~/Scripts/MacOS/lock_dockdash.sh status |
Checks DockDash file lock status. |
docx |
~/Scripts/MacOS/lock_dockdash.sh lock-strings |
Leaves localization worksheets unlocked and locks the DockDash string catalog. |
MCP & AI Tools Configuration#
| Alias | Command / Execution | Description |
|---|---|---|
mcp |
python3 ~/.mcp-config/apply.py |
Runs MCP settings compiler for all AI clients, then auto-commits & pushes changes to GitHub. (Pass targets like mcp codex) |
codexa |
printf "%s" "<KEY>" | codex login --with-api-key |
(Local-only) Dynamically authenticates Codex-CLI with your OpenAI API key. |
2.2 MCP Synchronization Functions#
pushmcp and pullmcp operate on the separate ~/.mcp-config repository, not on ~/Scripts. They are loaded from the tracked aliases file when ~/.zshrc sources it.
pushmcp() {
(
cd "$HOME/.mcp-config" || return
git add -- config.json apply.py bin/macos-mcp-wrapper
if ! git diff --cached --quiet; then
git commit -m "Update MCP configuration" || return
fi
git push origin main
)
}
alias pullmcp='(cd "$HOME/.mcp-config" && git pull origin main)'The post-commit and post-merge hooks in ~/.mcp-config/.git/hooks/ run apply.py after the corresponding Git operation, compiling the MCP configuration for the registered AI clients.
3. Local Configuration (~/.zshrc)#
The local .zshrc is maintained manually and kept out of version control. It stores private settings and sources the tracked aliases file.
3.1 NetBox and 1Password Account Context#
The NetBox item is stored in the personal Homelab vault. The service account used by MCP is intentionally restricted to the Homelab-MCP vault and must not be granted access to Homelab.
Therefore, the netbox alias removes OP_SERVICE_ACCOUNT_TOKEN only from the NetBox process with env -u. This does not disconnect or remove the service account from the shell or from MCP.
On a Mac where the personal 1Password session has not yet been initialized, run this once:
eval "$(env -u OP_SERVICE_ACCOUNT_TOKEN op signin)"Verify access without exposing secret values:
env -u OP_SERVICE_ACCOUNT_TOKEN op whoami
env -u OP_SERVICE_ACCOUNT_TOKEN op read \
'op://Homelab/netbox/add more/GOOGLE_CLIENT_ID' >/dev/nullAfter pulling an alias update, reload the shell with source ~/.zshrc.
Secrets Backup: The exact values for the private keys and tokens below are securely stored in your 1Password
Homelabvault under the entryMac OS .zshrc file. Refer to that entry during a system rebuild to restore your local profile.
3.2 Local Profile Structure#
Below is how your local ~/.zshrc file will look:
# Location: ~/.zshrc
# (This file is local-only and not committed to GitHub)
# 1. Private Security Tokens & API Keys
export OP_SERVICE_ACCOUNT_TOKEN="<YOUR_1PASSWORD_SERVICE_ACCOUNT_TOKEN>"
export OP_BIOMETRIC_UNLOCK_ENABLED=false
export ANTHROPIC_BASE_URL="http://localhost:11434/v1"
export ANTHROPIC_API_KEY="ollama"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
# Codex-CLI API Key Alias
alias codexa='printf "%s" "<YOUR_OPENAI_API_KEY>" | codex login --with-api-key'
# 2. Source the Tracked Aliases File
if [ -f "$HOME/Scripts/MacOS/Aliases/MacOS-Aliases.zsh" ]; then
source "$HOME/Scripts/MacOS/Aliases/MacOS-Aliases.zsh"
fi4. Implementation Plan#
To deploy this configuration management setup, complete the following tasks:
- 4.1 Create
MacOS-Aliases.zshFile: Extract all paths and aliases from the active~/.zshrcand save them to/Users/marc/Scripts/MacOS/Aliases/MacOS-Aliases.zsh. - 4.2 Clean Local
.zshrc: Remove the moved configurations from/Users/marc/.zshrcand append the block to source the new file. - 4.4 Commit & Sync Repository: Add
MacOS-Aliases.zshto your scripts repository, commit the changes, and push them to GitHub (which will mirror it to the NAS).
Validation for this setup is complete: reload ~/.zshrc, confirm aliases and functions with alias or whence -f, and run the read-only gitstatus command. Review changes before committing or pushing the Scripts repository.
5. Related Notes#
- Master Checklist: Mac OS - Recovery
- Software Configuration: Mac OS - Brewfile
- Linux Shortcuts: Linux - Aliases
- MCP Configuration: MCP Configuration Guide