Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
luckman212 committed Sep 26, 2024
1 parent 6a3c878 commit b5a8a75
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 13 deletions.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
# screencapture-nag-remover
<img src="./icon.png" width="96" />

# 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.

<figure>
<img src="./sample.png" width="200" alt="nag image" />
<figcaption style="font: italic bold 12px sans-serif;">Hey Apple, you forgot the “Always Allow” option!</figcaption>
</figure>

## 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 <path>` 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
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 25 additions & 12 deletions screencapture-nag-remover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path> 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>\(.*\)<\/key>.*/\1/p")

#bounce daemons so changes are detected
/usr/bin/killall -HUP replayd
/usr/bin/killall -u "$USER" cfprefsd
_bounce_daemons

0 comments on commit b5a8a75

Please sign in to comment.