Skip to content

Instantly share code, notes, and snippets.

@BeFiveINFO
Forked from joeshub/ST3-with-iCloud-Drive.sh
Created October 12, 2018 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeFiveINFO/48dbf8bbf279c4dd731d2417160adae6 to your computer and use it in GitHub Desktop.
Save BeFiveINFO/48dbf8bbf279c4dd731d2417160adae6 to your computer and use it in GitHub Desktop.
Sync your Sublime Text 3 Settings using iCloud Drive on multiple Macs
#!/bin/bash
# Notes
# Using iCloud Drive, you can sync your Sublime Text 3
# plugins and prefs so you can always have the same setup
# Prerequisites
# Make sure both machines have the latest version of OSX 10.10.x with
# Yosemite or higher and iCloud Drive turned on
# Quit ST3
# Pick a machine with ST3 that has the latest setup you want to start with
# Run step 1 and wait for your iCloud files to sync across the network
# Run step 2 on other machine(s) to duplicate the same settings
# Open up ST3 on the new machines and wait while ST3 updates your packages
# If you're using any system wide packages on the host machine
# (e.g. those installed via npm i -g) be sure to replicate them on the
# host machine(s) as well
# If your ST3 doesn't have Package Control make sure to install it
# https://packagecontrol.io/installation
# Set dir in variables
readonly SUBLIMETEXT3_PACKAGE_DIR=~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
readonly ICLOUD_DOCS_DIR=~/Library/Mobile\ Documents/com\~apple\~CloudDocs/
readonly MY_SUBLIMETEXT3_DIR=Preferences/Sublime\ Text\ 3/Plugins/
# Step 1) run this on the host mac that has the latest ST3 settings & packages
mkdir -p "$ICLOUD_DOCS_DIR$MY_SUBLIMETEXT3_DIR"
mv "${SUBLIMETEXT3_PACKAGE_DIR}User" "$ICLOUD_DOCS_DIR$MY_SUBLIMETEXT3_DIR"
cd "${SUBLIMETEXT3_PACKAGE_DIR}"
ln -s "${ICLOUD_DOCS_DIR}${MY_SUBLIMETEXT3_DIR}User"
# Steps 2) run this on your agent machine(s) you want mirroring the mac from step 1
# rm -rf "${SUBLIMETEXT3_PACKAGE_DIR}User"
# cd "${SUBLIMETEXT3_PACKAGE_DIR}"
# ln -s "${ICLOUD_DOCS_DIR}${MY_SUBLIMETEXT3_DIR}User"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment