Cipher Log

Chronicles in Language, Technology, and Law

Getting Time Machine to recognize a snapshot

July 27, 2022

Apple's Time Machine is a decent backup system for home users who don't want to get in over their heads. It's also decent for more advanced users who want a versioned history of backups (ChronoSync or Mac Backup Guru are other options, with the former having great reviews).

Unfortunately, Time Machine does a lot of "magic" -- there are things does things behind the scenes that are necessary to function properly, but which are inscrutable and undocumented. As a result, when things go wrong -- Backups.backupdb backup sets aren't imported or a specific dated snapshot directory isn't recognized -- it's very difficult to fix.

As it turns out, the metadata required to be recognized as a Time Machine snapshot is relatively straightforward. After a bit of trial and error, I wrote some shell scripts to automate the process of fixing Time Machine backups.

Please checkout the tmutils package on my GitHub page. Specifically, the tmimport.sh script should be helpful in getting a backup set recognized by Time Machine, and the tmbless.sh script should be helpful in making a specific dated snapshot directory show up within that backup set.

In fact, the tmbless.sh script is so effective that even a completely arbitrary and fabricated backup can be made to function in Time Machine, being fully recognized, appearing appropriately in the graphical UI, and allowing restore directly to your running system. See the images below for an example.

(Ideally I'd still like a way to thin out snapshots, especially since the "magic" of Time Machine often results in making complete, non-incremental backups whenever you move to a new computer, get a new backup drive, or restore an entire machine. Still playing with things like sudo rsync -aHAXUNDP --link-dest=../X X/ Y/ and so on. Note: the --link-dest parameter is relative to the target directory.)

Labels: ,

Installing a minimal emacs on macOS

July 20, 2022

Sadly, the folks over at Homebrew have decided not to maintain the emacs-nox package, which gave us a nice Terminal-only emacs editor. I spent some time playing with configurations today and got it to build just the way I want it.

First, use Homebrew to install dependencies only, and then to fetch the source only. Then we're going to copy the source archive to our home folder, extract it, and configure it appropriately. Then we'll build it and install it.

If you copy and paste this (single, large, compound) command into the Terminal and press Enter, you'll end up with a nice text-only emacs installation at /usr/local/bin/emacs. You may have to enter your password for the installation part.

brew install --only-dependencies emacs && \ mv `brew fetch -sf emacs 2>&1 | awk -F\: '/Downloaded to/{print $(NF)}'` ~/emacs.tar.xz && \ tar xvf emacs.tar.xz && \ mv "$(find ~ -name "emacs*" -type d -amin -10 -maxdepth 1 -mindepth 1)" emacsbuild && \ cd emacsbuild && \ CC=/usr/bin/clang ./configure --disable-build-details \ --without-xpm \ --without-jpeg \ --without-tiff \ --without-gif \ --without-png \ --without-rsvg \ --without-lcms2 \ --without-libsystemd \ --without-cairo \ --without-native-image-api \ --without-xft \ --without-harfbuzz \ --without-libotf \ --without-m17n-flt \ --without-toolkit-scroll-bars \ --without-xaw3d \ --without-xim \ --without-xdbe \ --without-gpm \ --without-dbus \ --without-gsettings \ --without-selinux \ --without-libgmp \ --without-x \ --without-xwidgets \ --without-imagemagick \ --without-ns \ --with-xml2 \ --with-included-regex \ --prefix=/usr/local && \ make && \ sudo make install

If you also want a very fast and minimal emacs setup, run the following command to modify your preferences:

printf "(setq inhibit-splash-screen t)\n(setq initial-scratch-message \"\")\n(switch-to-buffer \"**\")\n\n" >> ~/.emacs

Labels: , ,