diff --git a/README.md b/README.md index cec5737..c5d3bd8 100644 --- a/README.md +++ b/README.md @@ -1 +1,40 @@ -# screencapture-nag-remover + + +# macOS 15 screencapture nag remover + +## Abstract + +macOS 15 (Sequoia) introduced a new "security" feature which has frustrated many people, and insulted power users who prefer to have full control over their systems. The effect is nagging popups like the one below when apps that you have already granted permission to try to record your screen. + +
+ nag image +
Hey Apple, you forgot the “Always Allow” option!
+
+ +## How to use + +Download the latest release and place the script in your `$PATH` (I suggest `/usr/local/bin` if you're unsure). + +Then simply run the command with no arguments. It will iterate over any apps which have requested screencapture permissions and set the nag date for each to 100 years in the future. That _should_ prevent you from seeing the nag again. + +> **N.B.** _If [life expectancy][1] increases dramatically over the next few years, you might need to run the app again in a decade or two._ 😉 + +There are a couple of commandline arguments: + +- `-r` will reveal the .plist responsible for these nags in Finder +- `-p` will print the **current** values without making any changes +- `-a ` will create a new entry in the plist for an app that you specify. + +Example of manually adding an app: + +``` +screencapture-nag-remover.sh -a "/Applications/CleanShot X.app/Contents/MacOS/CleanShot X" +``` + +If you encounter any problems, please file an [issue][3]. And in case anyone [@Apple][2] is reading this, please get rid of this bothersome "feature"... + + +[1]: https://data.worldbank.org/indicator/SP.DYN.LE00.IN +[2]: https://github.com/apple +[3]: https://github.com/luckman212/screencapture-nag-remover/issues +[4]: https://github.com/luckman212/screencapture-nag-remover/releases diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..5429baf Binary files /dev/null and b/icon.png differ diff --git a/sample.png b/sample.png new file mode 100644 index 0000000..b5c1b19 Binary files /dev/null and b/sample.png differ diff --git a/screencapture-nag-remover.sh b/screencapture-nag-remover.sh index e5d0b72..2bba233 100755 --- a/screencapture-nag-remover.sh +++ b/screencapture-nag-remover.sh @@ -9,30 +9,43 @@ fi PLIST="$HOME/Library/Group Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist" FUTURE=$(/bin/date -j -v+100y +"%Y-%m-%d %H:%M:%S +0000") +_bounce_daemons() { + /usr/bin/killall -HUP replayd + /usr/bin/killall -u "$USER" cfprefsd +} + +_nagblock() { + [[ -n $1 ]] || { echo >&2 "supply complete pathname to the binary inside the app bundle"; return 1; } + [[ -e $1 ]] || { echo >&2 "$1 does not exist"; return 1; } + IFS='/' read -ra PARTS <<< "$1" + for p in "${PARTS[@]}"; do + if [[ $p == *.app ]]; then + echo >&2 "disabling nag for $p" + /usr/bin/defaults write "$PLIST" "$1" -date "$FUTURE" + return 0 + fi + done + return 1 +} + case $1 in -h|--help) /bin/cat <<-EOF ${0##*/} [args] - -r,--reveal show the related plist in Finder - -p,--print print current values + -r,--reveal show the related plist in Finder + -p,--print print current values + -a,--add manually create an entry (supply full path) EOF exit ;; -r|--reveal) /usr/bin/open -R "$PLIST"; exit;; -p|--print) /usr/bin/plutil -p "$PLIST"; exit;; + -a|--add) _nagblock "$2"; _bounce_daemons; exit;; esac while read -r APP_PATH ; do - IFS='/' read -ra PARTS <<< "$APP_PATH" - for p in "${PARTS[@]}"; do - if [[ -e $APP_PATH ]] && [[ $p == *.app ]]; then - echo 1>&2 "disabling nag for $p" - /usr/bin/defaults write "$PLIST" "$APP_PATH" -date "$FUTURE" - break - fi - done + _nagblock "$APP_PATH" done < <(/usr/bin/plutil -convert xml1 -o - -- "$PLIST" | /usr/bin/sed -n "s/.*\(.*\)<\/key>.*/\1/p") #bounce daemons so changes are detected -/usr/bin/killall -HUP replayd -/usr/bin/killall -u "$USER" cfprefsd +_bounce_daemons