Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I use a single .zshrc file on macOS and Windows (WSL2)

Описание и применение

Автор использует один файл .zshrc для macOS и Windows (WSL2), синхронизируя его через Git и символические ссылки, чтобы избежать дублирования настроек.

Задача

Maintaining separate Zsh configuration files for macOS and Windows (WSL2) leads to duplication and inconsistency.

Результат

The author now maintains one .zshrc file, reducing duplication and ensuring consistent aliases, functions, and plugins across macOS and WSL2.

Рабочий процесс

  • 1. Create a Git repository to host the shared .zshrc file.
  • 2. Store the .zshrc in the repository root.
  • 3. On macOS, add a symlink: ln -s /path/to/repo/.zshrc ~/.zshrc.
  • 4. On WSL2, add a symlink: ln -s /mnt/c/path/to/repo/.zshrc ~/.zshrc (or place it in /etc/zsh/zshrc if system-wide).
  • 5. Commit and push changes to the repo whenever the configuration is updated.
  • 6. Pull the latest changes in both environments to keep them in sync.

Доказательства

I use a single .zshrc file on macOS and Windows (WSL2).

Источник

  • Дата записи: 2026-09-20T02:45:32.552Z