Mac OS X Lion was introduced in 2011 and came with a new feature called Power Nap. This allows computers to receive push notifications, check for new messages, update calendar events, run iCloud updates, download software updates, and run Time Machine backups in the background while a computer is asleep – they don’t go all the way to sleep, they just kinda’ take a nap. Application persistence was released the next year and is an API that Apple uses in a number of programs on and exposes to third party software developers who can opt into the ability to have the state of an application persist and be restored when…
-
-
Logic Pro scripty bits: tracking current Input device
Got a call recently for a post house that wants to have a dashboard of what input devices are running in Logic Pro across a fleet of audio edit bays. Logic still uses a standard .plist format to store settings in ~/Library/Preferences/com.apple.logic10.plist. So it’s easy enough to read and write settings. There’s a lot in there but let’s focus on just the Current Hardware, which is in a dictionary called AudioHardwarePreferences. We can find that by running the defaults command on the defaults domain com.apple.logic10 followed by the dictionary name: defaults read com.apple.logic10 AudioHardwarePreferences The output then shows us the last few and some other information (e.g. we can actually…
-
Reviewing TCC dialog prompts using logs on a Mac
I wrote this awhile back on using the logging facilities in macOS to review and parse logs. The log command provides a number of options to see various events on a Mac. I was recently working on an app that was automatically denying a prompt to generate entitlements and thought I’d post how to find the logs for that. First, let’s find all prompts. We’ll do that using the com.apple.TCC subsystem as a predicate. In the below command we simply pipe the output to grep for Prompting. /usr/bin/log show -style syslog --predicate 'subsystem == "com.apple.TCC"' --info --last 12h | grep Prompting I’d much rather use “&& contains” in syslog because…
-
Apple’s Lost Decade
-
Quick And Dirty Recursive Find And Replace
There’s a directory full of .dat files that I needed to change a string in. But there were hundreds of files nested in different folders in a directory, let’s just call it /var/folders/apptemp. The following command would change hello to hi. It aint purdy and we’re piping to xargs ’cause stdin but it works. This can be kinda’ dangerous so proceed with caution: find /var/folders/apptemp -name "*.dat" -print0 | xargs -0 sed -i '' -e 's/hello/hi/g'
-
Disable Smart Dashes in macOS
When I’m writing scripts in an IDE, the smart dashes on the Mac can end up killing me. This is where the — turn into —. To disable this feature: defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false To turn smart dashes back on: defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool true
-
Printing With Expanded Dialogs By Default on the Mac
I’m always configuring something on my printers every time I print. So now I just have it expand the printer dialog rather than give me the simple screen you see here: To configure, just un the following: defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool truedefaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true Then it looks like this. 🙂
-
Disable Automatic Software Update Downloads
I was on the phone with someone yesterday that has a number of distributed Macs in offices with low bandwidth. So they need to control when updates are downloaded and installed because they can fail or cause issues with other systems when they download automatically. This option is great for home use but can be challenging in larger environments. So it can be disabled with the following command, which creates an AutomaticDownload key in the com.apple.SoftwareUpdate defaults domain and sets it to FALSE: sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -boolean FALSE Once machines return to areas with better bandwidth or this isn’t a need it can then be re-enabled by using…
-
Tor and Scripting on macOS
Tor, short for The Onion Router, is a tool to anonymize your web traffic. Tor is simple to use and yet incredibly complicated under the hood. You install software, available at www.torproject.org, or a browser extension. Tor routes your data through a bunch of nodes. Each of those computers or routers is only aware of the node in front of or behind it in the communication route and encrypting the next node sent. Since each step is encrypted, these layers of encryption can be considered like a network with layers like an onion. So if each step is partially encrypted, a compromise of any device in the route will still…
-
Use Sidecar With Unsupported Macs
Sidecar is that spiffy new feature that allows you to extend your Mac desktop to an iPad. It’s cool but only officially supports the following devices; Any 27-inch iMac from Late 2015 or newer Any iMac Pro All MacBook Pros since 2016 2018 MacBook Air Early 2016 12-inch MacBook (or newer of course) 2018 Mac mini 2019 Mac Pro Here’s the thing, those limitations are set based on performance of the machine. The /System/Library/PreferencePanes/Sidecar.prefPane actually shows support for a couple of keys that allow you to use Sidecar even if your device isn’t one of these. Buyer beware though, if you end up with performance issues then run the same…