• Mac OS X,  Mac Security

    Use crypt_and_hash to Encrypt Files From A Shell On macOS

    One of the packages that can be installed with homebrew is mbedtls, which gives access to a number of cryptographic libraries. To install mbedtls: brew install mbedtls Encrypting a file is then fairly straight forward. Call crypt_and_hash and use a 0 in the first positional parameter to encrypt a file or a 1 to decrypt. Then provide the path to the file in the second position (in this example, mac.json, the target file name (mac.aes in the example), the hash in the fourth (CAMELLIA-256-CBC in the example command), the digest (SHA1 here), and the key to encrypt the information (hex:ABCD123456789 in this example) crypt_and_hash 0 mac.json mac.aes CAMELLIA-256-CBC SHA1 hex:ABCD123456789…

  • bash,  Mac OS X,  Mac Security

    Get Telemetry on App and System Extensions in macOS

    Application extensions allow developers to import common SDKs into projects so they can build increasingly interesting apps without developing a lot of code for those things vendors expose. The Apple extensions typically allow a developer to bring in various Apple libraries and then call them in their code. For example, com.apple.quicklook.thumbnail is used to produce thumbnails in quicklook; therefore Apple apps like iBooks and Shortcuts and any 3rd party developer like MindNode that wants to use Quicklook can provide a known and so somewhat seamless user experience. Click on the Privacy & Security System Preferences and then Extensions and then Quick Look to see the non-Apple apps that use the…

  • bash,  Mac OS X

    One Liner to Loop Through a Directory for Last Used Date of Apps on a Mac

    Here we load in a list of Apps in the /Applications directory and then echo them along with the kMDItemLastUsedDate from Spotlight via mdls: ls /Applications | while read APP;do echo "$APP" ; echo `/usr/bin/mdls /Applications/"$APP" |  /usr/bin/grep -w kMDItemLastUsedDate`; done The output per item would then look something like this: Apple Configurator.app kMDItemLastUsedDate = 2022-09-27 18:25:21 +0000 awk can get the $3 if that’s all that’s needed or other filtering tools can limit the output. Or get more output, like a bundle ID (kMDItemCFBundleIdentifier) or an Apple Store ID (kMDItemAppStoreAdamID) for parsing through other tools. Further no need to echo the string of the name of the app according…

  • Mac OS X

    Free Space Required for Modern macOS Upgrades

    The amount of free space required to upgrade a Mac has increased drastically in the run-up to and since the introduction of apfs-based snapshots in 2016. The amount of required free space had been growing steadily in the HFS+-era of file systems, but as more elements of iOS (like a modern file system) came to the Mac, and as the Mac transitioned to a fully 64-bit operating system, that number escalated and never returned now that the transition away from things like 32-bit apps and kexts is finished. Sierra (Mac OS X 10.12) had a minimum drive capacity of 8.8 GB but really needed more like 12 GB; however there…

  • Mac OS X,  Mac Security,  Swift

    Removing Extensions Cruft from macOS

    Extensions have gotten a pretty substantial overhaul over the past few years. Traditionally, a kernel extension (or kext for short) would usually be located in /Library/Extensions or /System/Library/Extensions and have a file extension (no pun intended) of .kext. Apple began to move away from Kernel Extensions and towards more purpose-built extensions, which included System Extensions, located at /Library/SystemExtensions. Apple also introduced a number of new extension types that reside in application bundles. An app can load the extension and developers get those features “for free” rather than writing their own code to do what they once had to do with Kernel Extensions. To remove Extensions, Apple has introduced the Extensions…

  • cloud,  Mac Security,  Swift

    Configure Amazon SNS for Mac and iOS APNs Development

    Amazon SNS makes implementing Apple Push Notifications (APNs) a breeze. This might seem like a longer article but it’s really not as many steps as it seems (although buttons on web pages move around a lot so ymmv for specific words in button names). There’s a few main steps that we’ll go through: creating a cert in Keychain, generating a Push Notifications cert with the appropriate bundle ID and team ID, and adding an application instance. Notice that these are different for Mac and iOS so if doing both use iOS and if doing one for each, use the appropriate entry. Create a Cert in Keychain First, we’ll create a…

  • Mac OS X,  Mac OS X Server,  Mac Security

    Can’t Schedule Reboots in Ventura: Mac Observer’s Gotcha

    I was talking to Jeff Butts at Mac Observer yesterday and he mentioned something I hadn’t noticed: macOS Ventura removes the option to schedule an automatic reboot from the graphical interface. I actually went back a version and couldn’t find it there. I guess since I don’t have servers I hadn’t noticed this oversight. Or I guess it’s more emblematic that it’s not an oversight, it’s how the use of the Mac has shifted over the years. The old power management system preference features are still there – Jeff wrote an article how to use pmset to set the automatic reboot feature at https://www.macobserver.com/tips/how-to/how-to-schedule-your-mac-to-shutdown-or-reboot-in-macos-ventura/. Around 13 years ago, I wrote…

  • bash

    Inverse Case Insensitive Multiple Matching for grep

    The apropos command is used to show man pages that exist on Linux, Mac, and Unix. It’s useful to, let’s say, look for a command that includes a given word in the description. It can also be used to show all commands that have man pages (and some that don’t). To see all commands for a machine, simply run apropos with a wildcard (*): apropos * This will take a while. Not all commands can actually be used. Constrain output (which takes no less runtime) by piping the output to a grep command. The -i option can be used to make grep parsing case insensitive. This means that if we…