Command line Utilities for the Administrator:
ljt – The “little JSON tool” is a safe and easy way to parse JSON and retrieve values natively in your shell scripts, no external dependencies required! Like the
jsc, however unlike the
jpt, this little JSON tool only gets values, nothing else. This keeps it nice and small and easily embedded into your shell scripts, the minified function is a scant 1.9k
Github project page: ljt
Tagged blog posts: scripting/ljt/
What you can do with the jpt? Query JSON documents using either the simple yet expressive JSONPath syntax or the singular and precise JSON Pointer (RFC6901) syntax. The output mode is JSON but additional creative output modes can render JSONPaths, JSON Pointer paths, or even just the property names with their “constructor” types (try -KC with -J or -R) Textual output can be encoded in a variety of formats (hex/octal/URI encoding, Unicode code points, etc…), data can be modified using both JSON Patch (RFC6902) operations (add, replace, remove, copy, move, test) and also JSON Merge Patch (RFC7386) operations. JSON can be worked with in new ways, try
-L for “JSONPath Object Literal” output to see what I mean. Or you simply feed
jsc a file to pretty-print (stringify) to /dev/
stdout. I’ll be writing more about this one for sure.
Github project page: jpt
Tagged blog posts: scripting/jpt
shui – first-class Applescript dialog boxes in your shell scripts without needing to remember esoteric Applescript phrasings! If you think it’s odd for code to have possessive nouns and are more comfortable in shell, you’re not alone. shui can be embedded in either bash or zsh scripts but it can also output Applescript if you really want to know how the sausage is made or want to embed in your script without shui. Hopefully shui will let you forget those awkward Applescript phrasing and focus on your shell script’s features and functionality. It uses
osascript to execute the Applescript and
launchctl to invoke
osascript in the correct user context so user keyboard layouts are respected (vs. root runs). Check out the project page for demo videos and then give shui a try.
Project page: shui
Tagged blog posts: scripting/shui
setUserTemplateDefaultDocks – For the Jamf Pro admin, this will copy the localized default.plist from inside Dock.app to the appropriate localized User Template folder, adding a GUID and file-label to each entry to satisfy the Jamf Pro Dock Item payload code that looks for these elements when adding or removing icons. Failing to add these Jamf Pro will nuke the default.plist FYI
RemoveItemFromDock – Command line utility to remove items from the dock
AddItemToDock – Command line utility to add items to the dock.
AddLoginItem – Command line utility to add items to users’ login items
createRecoveryHDUpdater 15.4.6.command – built PKG now is targetable to volumes other than / (Note: Recovery HD updater packages for 10.11 will only work when run in OS X 10.11, previous packages could run in different OSes not so for 10.11). This is only useful for HFS+ formatted disks. APFS need not apply (it will make an HFS+ partition on your APFS disk BTW)
Widgets for Wonks:
Rebuilt with Platypus (5.3) these 64-bit menubar apps will still run on Catalina, however they are un-notarized and unsigned. But why trust me or Apple, if you want to know what the do just look inside at the bash script that makes it tick.
XProtectPluginChecker – Quickly survey the status of Java, Flash, and any other Plug-Ins Apple deems insecure and unworthy of your usage.
myXProtectStatus – A drop down status menulet, showing date, version, and threats protected against in the Xprotect plist. Written in bash, wrapped by Platypus, it is informational only (so don’t ask me to add some menu item to do something, it just reports). Tuck it away somewhere and add to your loginitems.
Screenshot of myXProtectStatus:
Exercises in Applescript :
If you have OS X 10.5 you’ll think this is neat… you’ll also be on a very old computer…
ToggleDock – Toggle the Dock appearance from “glass” to “no glass” when in horizontal mode.