Skip to content

usblsb/mac-sync-bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mac-sync-bootstrap

Minimal CLI tool to synchronize macOS applications across multiple Macs using:

  • Homebrew
  • Homebrew Cask
  • Mac App Store via mas
  • iCloud Drive

The project exports the installed app list from one Mac, stores it in iCloud, and installs missing apps on another Mac without external servers.

Objective

mac-sync-bootstrap is intended for machine bootstrap and repeated sync between Macs that share the same Apple ID.

Main goals:

  • Export installed packages and apps from one Mac
  • Store the sync state in iCloud Drive
  • Import missing apps on another Mac
  • Keep repeated executions safe and idempotent

Requirements

  • macOS
  • iCloud Drive enabled
  • Same Apple ID on all Macs involved
  • Internet connection for package installation

Homebrew and mas are handled by install.sh if missing.

Project Files

sync_mac_apps.sh

Main sync script.

Supported commands:

  • export: exports the current machine state to iCloud
  • import: installs what exists in iCloud and is missing locally
  • sync: runs import first, then export

What it manages:

  • Homebrew formulae
  • Homebrew casks
  • Mac App Store apps from mas

Operational behavior:

  • Creates a lockfile to avoid concurrent execution
  • Writes logs to a local logfile
  • Uses brew bundle for Brew/Brew Cask sync
  • Uses mas list and mas install for App Store sync

install.sh

Bootstrap installer.

What it does:

  • Copies sync_mac_apps.sh to ~/sync_mac_apps.sh
  • Makes it executable
  • Installs Homebrew if missing
  • Installs mas if missing
  • Loads the correct brew environment for Apple Silicon and Intel

Brewfile.example

Reference file for the expected Brewfile format used by brew bundle.

At the moment, the real working Brewfile is generated automatically by:

~/sync_mac_apps.sh export

LICENSE

Project license file.

Storage Paths

The script stores sync data in iCloud here:

~/Library/Mobile Documents/com~apple~CloudDocs/MacSync/

Generated files:

  • Brewfile
  • appstore_apps.txt

Local runtime files:

  • Logfile: ~/Library/Logs/sync_mac_apps.log
  • Lockfile: /tmp/mac_sync_bootstrap.lock

Installation

Clone the repository:

git clone https://github.com/your-user/mac-sync-bootstrap.git
cd mac-sync-bootstrap

Run the installer:

chmod +x install.sh
./install.sh

After that, the main command is available at:

~/sync_mac_apps.sh

Basic Workflow

1. Source Mac: export installed apps

Run this on the Mac that already has the apps you want to replicate:

~/sync_mac_apps.sh export

Result:

  • A Brewfile is generated in iCloud
  • An appstore_apps.txt file is generated in iCloud

2. Target Mac: import missing apps

Run this on the other Mac:

~/sync_mac_apps.sh import

Result:

  • brew bundle installs missing formulae and casks
  • mas installs missing App Store apps
  • Existing apps are not reinstalled

3. Keep both sides updated

Run:

~/sync_mac_apps.sh sync

This does:

  1. Imports anything already stored in iCloud
  2. Exports the current local state back to iCloud

Useful when a Mac acts both as consumer and source of truth over time.

Command Reference

~/sync_mac_apps.sh export

Exports the current machine state to iCloud.

Use it when:

  • You installed new Brew packages
  • You installed new casks
  • You installed new App Store apps
  • You want to refresh the shared state

~/sync_mac_apps.sh import

Imports the shared state from iCloud into the current machine.

Use it when:

  • You are preparing a new Mac
  • You want to align one Mac with another
  • You want to install what is missing locally

~/sync_mac_apps.sh sync

Runs import followed by export.

Use it when:

  • You want a safe incremental sync cycle
  • The current Mac may both receive and publish changes

Notes

  • The project uses zsh.
  • The script is designed for repeated execution.
  • brew bundle already skips installed items when possible.
  • App Store installation requires the same Apple ID to be signed in.
  • The script uses brctl download to request iCloud files before import.

Maintainer

Support

  • Use GitHub Issues for bug reports, questions, and feature requests.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages