• Q&D cmd-line to show dependency graphs for `brew outdated`

    brew outdated -q | while read searchRoot; do
        echo 'checking for '$searchRoot'...'
        outFile=/tmp/$(date +%Y%m%d-%H%M%S)_brew_${searchRoot}.gv
        fullGraph=$(brew deps --installed --dot --graph --include-requirements --for-each --annotate)
        for i in $(seq 1 $searchIterations); do
            newNodes=$(echo "$fullGraph" | egrep " -> \"($nodeList)" | cut -d\" -f2,4 -s | tr '"' '\n' | sort | uniq | tr '\n' "|" | sed 's/|$//')
            if [ -n "$newNodes" ] 
                nodeListNew=$(echo "$nodeList"$'\n'"$newNodes" | tr '|' '\n' | egrep -v '^$' | sort | uniq | tr '\n' "|" | sed 's/|$//')
            if [ "$nodeListNew" = "$nodeList" ] 
        potOut=$(echo "$fullGraph" | egrep "$nodeList" | sort | uniq)
        echo 'digraph {'"$potOut"'}' > "$outFile"
        dot -O -Tpdf "$outFile"
        open "$outFile".pdf

    Code tested on macOS 14.4, with the following extras: brew, graphviz (containing dot)

  • dump iCloud Mail Rules to human-readable format

  • mac file sharing settings cleared

    seems to have happened just after applying the 14.3.1 update (though has happened before):
    all settings missing from the GUI, and sharing -l shows the same - nothing. 😕

    easy enough to re-config - at least after I determined this was the problem, and scratched my head to remember what shares were defined.
    (might want to cron sharing -l, to keep a log of the config)

  • Interesting underscore artifact in recent versions of macOS Terminal

    a thin horizontal line, somewhere before the current cursor…
    it’s apparently a leftover bit of the cursor which (regardless what style cursor you have) displays in the underline format, where a cursor was.
    selecting that line (ex: triple-click) clears the artifact.

  • Ian McDonald’s “The Little Goddess” is beautiful, brilliant - a page-turner! From The Very Best of the Best. Apparently, a novella from River of Gods - my next stop!

  • csvkit to import CSVs in a uniform format

    I’ve really been enjoying the power of csvkit to reliably munge CSVs into a uniform format - regardless the format from the provider (not only the order of columns, but also more complex transformations like whether debits are positive or negative):

    SQLALCHEMY_SILENCE_UBER_WARNING=1 csvsql --no-inference \
    --query 'SELECT COALESCE("Transaction Date",""),"=-"||COALESCE("Amount (USD)",""),COALESCE("Category",""),COALESCE("Description","")||"||"||COALESCE("Merchant","")||"||"||COALESCE("Type",""),"Apple Card" \
    FROM stdin' \
    | csvformat -T | tail -n+2 | sort

    ref: https://csvkit.readthedocs.io/

  • for each Time Machine destination, display: ID, date & human-readable destination

        echo 'Current status of TM destinations:';
        destInfo=$(tmutil destinationinfo | \
            sed 's/^> //' | \
            tr '\n' '\;' | \
            sed -E 's/  +:/:/g' | \
            sed -E "$remvHeaders");
        defaults read /Library/Preferences/com.apple.TimeMachine.plist Destinations | \
            egrep -v ',$' | \
            sed -E -e ':a' -e 'N' -e '$!ba' -e 's/\n[[:blank:]]+"/ /g' | \
            sed -E 's/^[[:blank:]]+//' | \
            fgrep -e DestinationID -e SnapshotDates | \
            sed -e ':a' -e 'N' -e '$!ba' -e 's/;\n/;/g' | \
            sed 's/( /"/' | \
            while read -r theLine; do
                    destID=$(echo "$theLine" | \
                            cut -d\" -f2);
                    snapDate=$(echo "$theLine" | \
                    cut -d\" -f4);
            echo $destID $snapDate$(echo "$destInfo" | \
            fgrep "$destID" | \
            sed 's/;ID.*$//' | \
            sed -E -e 's/;[^: ]+: / /g');
        done | sort -rn
  • wow; I just read my first work by Eleanor Arnason - “Potter of Bones” (in “The Very Best of the Best” anthology) is smart, enchanting, fresh, and I’m looking forward to more!

  • open iftop for each (cfg’d) network interface:

    for i in $(ifconfig -lu); do if ifconfig $i | fgrep -v 'inet 127.' | grep -q "inet [0-9]"; then echo $i; fi; done | while read intfc; do osascript -e "tell application \"terminal\" to do script \"sudo iftop -i $intfc\""; done

    (Mac; could be adapted)

  • Partially-formed process, to convert RTF formatting (ex: lists) from clipboard / pasteboard, to paste into Markdown format (ex: git):

    osascript -e 'the clipboard as «class RTF »' | tr -d '«»' | sed 's/^data RTF //' | xxd -r -p | /usr/local/bin/pandoc -f rtf -t markdown

    (for Mac; could be adapted)

  • strange: when adding a link to an (Apple) Notes document: if the URL has a comma, everything up to the comma is silently stripped (permanently; editing the URL afterward, is too late) - one solution is to encode commas (the first time) as %2C

  • A sudo softwareupdate --install --all never got past Downloaded. 😕 No prompt (cmd-line or GUI) to restart & nothing in-process (ex: verification). I was watching logs, and saw nothing amiss. Solution was to ^C & run it again - with --restart too.

  • Uninstall is sometimes not so simple

    Drat; I’ve been meaning to try the Smile AppleScript editor, but waited too long, and it’s incompatible with modern macOS - HOWEVER:

    I trashed the /Applications/Smile directory (no uninstaller in there), and then re-opened Script Editor to get back to work - but it hung; never completed startup and showed no error messages. Strange.

    After a bit of debugging, I recalled that when I’d installed Smile - since I luckily already had Apple’s built-in Script Editor app open - the Installer told me it had to quit that first. Interesting - and seemed maybe relevant now.

    So I started hunting for evidence of just what had been installed - likely something conflicting with Script Editor (at least).

    /var/log/install.log did have some info, and so did /private/var/db/receipts - which led to the solution (in my case anyway), which was also deleting these directories:

    /Library/Application Support/Smile

    After which, Script Editor was able to finish startup - and even showed the unsaved script that I’d been working on. Nice.

  • ugh: in a dir within iCloud Drive, replacing a regular file, with a symlink of the same name, apparently breaks sync’ing 😟 - and good luck trying to find that via brctl log -w. (only reason I knew it broke: a periodic check of sync status)

  • oh; weird: if you happen to have /tmp open in a Finder window, brew install wget fails with dir_s_rmdir - apparently due to a “.DS_Store” file, a few levels below /tmp

  • macOS Login Items, and other "Allow in Background"

    There are lots of Login Items and other “Allow in Background” items in macOS these days (especially if the Mac is managed…) so it can be useful to get a list of them all - especially when names shown in the GUI, are not clear. The dumpbtm tool is verbose - though generally all you need is this abbreviated list:

    sfltool dumpbtm | grep -E '^([[:blank:]]{0,1}[^[:blank:]]|[[:blank:]]*(Name|URL):)'

  • how to convert macOS clipboard RTF (ex: from Notes.app), to Markdown? this’ll get you 95% of the way there: osascript -e 'the clipboard as «class RTF »' | tr -d '«»' | sed 's/^data RTF //' | xxd -r -p | /usr/local/bin/pandoc -f rtf -t markdown

  • How strange: On one Mac I use, when I paste (cmd-V) into the filename field (has focus) in a Save dialog, it suddenly jumps to the Documents folder. On another Mac, it simply pastes, leaving the folder as-is. It apparently does this jump, on any keyboard equivalent (ex: cmd-A).

  • The macOS Weather app can notify for severe weather - it’s Settings window, directed me to Settings > Notifications – but Weather was mising. I stumbled on a solution: Open Notification Center & open Weather from there - it immediately prompted to enable. (C’mon Apple :/ .)

  • I started a Note, with lists of of word / term associations - which make sense to me. Since Spotlight indexes Notes.app, the results come up in that context with everything else, so it’s already started to help me find things more quickly. Might try to integrate with Quicksilver…

  • How strange: I just got a “Magic Keyboard” for my M1 MacBook Air - and its Globe key works (to show Character Viewer) – only when not in clamshell mode. It works in either mode, for other things like Dictation.

  • Apparently it's time for M1 users, to migrate their Homebrew config. Like right now.

    Drat; that was an unpleasant surprise:

    For some reason, when I tried brew upgrade today, the response was: Cannot install in Homebrew on ARM processor in Intel default prefix.

    Weird; it’s been working fine, via Terminal in Rosetta, on my M1, for quite some time. Last I saw, that was required, on Apple Silicon.

    I don’t see any warning logged from past “brew update” runs. And I couldn’t find any announcement or release note, that Homebrew is now ready for prime-time on M1 - but apparently someone felt it necessary to force the issue. :/

    So, since I depend on brew and several tools installed that way - including some automation - I dropped what I was supposed to be doing, to sort this out. Here’s what it took for me:

    1. Run brew bundle dump - this will create a Brewfile in the current directory.
    2. May or may not be necessary: Quit & relaunch Terminal, without Rosetta.
    3. Install Homebrew - let it go to the new dir, /opt/homebrew/ - AKA ${HOMEBREW_PREFIX}.
    4. Run brew dump - which uses the previously-created Brewfile, to (hopefully) install what you were using (as much as it can) in it’s new structure, in ${HOMEBREW_PREFIX}.
    5. As long as this succeeded, delete / archive the Brewfile. If not, debug…
    6. If you haven’t personalized $PATH etc.: Follow the directions (in the output above) for updating that.
    7. If you have (personalized $PATH etc.): Update that to also include ${HOMEBREW_PREFIX} (using the ouput as a guide) - note that there are some new environment vairables here, to consider adding to your shell’s config. You’ll likely want to make sure the new dir is before the old one (so any tools not yet updated are still accessible - and new tools take precedence over the now stranded ones).
    8. Update any needed configs that live in /usr/local (ex: for clamav), into the correct place in the new ${HOMEBREW_PREFIX}.
    9. Now find wherever you might have references to brew tools, which are hard-coded for /usr/local, and update instead, to ${HOMEBREW_PREFIX}. Suggestions of places to look: /etc/crontab, user-specific crontabs (ex: crontab -l), LaunchItems and such. And scripts that might be hard-coded for /usr/local. (Yes; hard-coding is “bad” - and sometimes useful to, for example, be sure to use the tool installed via brew, vs. a built-in tool by the same name.)
    10. Repeat on any other systems you need to.
    11. Set a reminder to clean out the stuff in /usr/local, once it’s no longer needed. (It might be sufficient to which each tool, and confirm when they’re all found in ${HOMEBREW_PREFIX} vs. the old /usr/local.)

    Whew! That seemed a bit more difficult than necessary - especially since it was (as far as I could tell) forced without warning.

  • Wow; the new Spatial Audio feature (AirPods) is cool - though rather disorienting in some situations; here’s how to control it: support.apple.com/guide/air…

  • Oh for the love of… Zoom on Mac may be recording you even when you’re not using it. How many “oops” does one org get?!

  • quick way to get notified that your other Mac (maybe a server?) has some software updates available: swupd_remote_check.sh

subscribe via RSS