icloud-dotfiles
Having been burned a few times by different dotfiles strategies, I decided to just roll my own. Feel free to copy this if you're so inclined.
The basic gist of this:
- Store dotfiles in iCloud Drive
- Store secure dotfiles (e.g. environment variables) in an encrypted disk image in iCloud Drive
- Have a script that symlinks iCloud drive & dotfiles to my home directory and installs (or updates) the programs I use, such that it can be re-run gracefully
Setup
1. Fetch the dotfiles and throw them in iCloud Drive
Fork this repo and clone it into your iCloud Drive as "dotfiles" like so:
$ git clone https://github.com/searls/icloud-dotfiles.git "~/Library/Mobile Documents/com~apple~CloudDocs/dotfiles"
2. Create an encrypted disk image
Create an encrypted disk image named "secure.dmg" with volume label "secure-dotfiles" and place it inside the "dotfiles" directory.
Once created, open the disk image, and check the box to add the password to your Keychain.
Next, create any files that need to be stored securely. In my case this was:
$ touch /Volumes/secure-dotfiles/.env
$ touch /Volumes/secure-dotfiles/.homebridge-config.json
Finally, add the disk image to your login items so that it's always available while you're logged in:
3. Run the setup script
Now, run the initial setup script (which you can review here):
$ ~/Library/Mobile\ Documents/com~apple~CloudDocs/dotfiles/bin/setup-new-mac
In my case, this sets up my symlinks, installs/updates my brew formulas, sets up Node & Ruby, mounts my encrypted dotfiles and then sources my bash profile.