Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

toonetown

macrumors newbie
Original poster
Nov 29, 2012
9
5
So - I have a shell script that will work on Catalina when I run it from Terminal (I have added Terminal to "Full Disk Access"), but the script will not access anything in ~/Documents when I set it up to run as a LaunchAgent. I have even tried adding launchd to Full Disk Access and *nothing*. The individual script, /bin/bash, etc. have all turned out fruitless.

Has anyone had any luck specifying something in the security preference pane to allow for a script to run as a LaunchAgent and access "protected" resources?
 

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,285
4,973
Wild guess here. Maybe make your script an app, then give the app permission in Security preferences?

Simple enough to just create the folder structure, put the script in, "chmod -R +rx my_app.app"

Code:
my_app.app
  |
  ---Contents
       |
       ----- MacOS
              |
              ----shell_script_here

ADD: the shell script needs to called same as the app. So in this case, "shell_script_here" needs to be "my_app" (with no .app).

And if want to hone some Mac skills, can use the Automator app to create your application: "New Document" > Application
 
Last edited:
  • Like
Reactions: frou

toonetown

macrumors newbie
Original poster
Nov 29, 2012
9
5
That’s a good idea...i don’t think you can just create an app like that with a script, but you can use Platypus to write a script-based app. That’s a great idea - I will have to try it out. Thanks!
 
  • Like
Reactions: frou

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,285
4,973
i don’t think you can just create an app like that with a script

Sure you can. Done it myself. Stock *nix stuff only (mkdir, vi, chmod). For example:

Code:
% find BoxSync.app
BoxSync.app
BoxSync.app/Contents
BoxSync.app/Contents/MacOS
BoxSync.app/Contents/MacOS/BoxSync

#!/bin/sh
#
# copy select Dropbox folders to Box cloud service
#

d_dir="$HOME/Box Sync"

if [ ! -d "$d_dir" ]
then
echo "\"$d_dir\" is not mounted"
exit 1
fi

cd ~/Dropbox
rsync -a -L 'Freq Files' "$d_dir"
rsync -a -L 'Work Docs' "$d_dir"
rsync -a -L Travel "$d_dir"
rsync -a -L 'Computer Info' "$d_dir"

'/Applications/Box Sync.app/Contents/MacOS/Box Sync' &
exit 0
 
Last edited:

TimothyR734

macrumors 68030
Apr 10, 2018
2,723
2,753
Logsden Oregon
If your script is this it goes in /Library/LaunchDaemons folder then reboot
 

Attachments

  • CatalinaAutoMountWritable.plist.zip
    1.4 KB · Views: 339
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.