IconBlock saves and restores macOS Desktop icon positions from the command line.
iconblock save ~/Desktop/layout.iconblock
iconblock restore ~/Desktop/layout.iconblock
iconblock inspect ~/Desktop/layout.iconblock
iconblock doctor
If displays change or Finder automatically arranges the icons, IconBlock asks for confirmation. For automation:
iconblock restore ~/Desktop/layout.iconblock --yes --json
The first run may request permission to control Finder in System Settings > Privacy & Security > Automation.
brew tap driade/icon-block https://github.com/driade/icon-block
brew install driade/icon-block/iconblock