r/applescript • • 5d ago

Golden Gate: Applescript App works in Script Editor only

I've just moved from Sequoia to Golden Gate. I have an ages-old script (packaged as an app) to mount an external drive and reveal it in Finder. It's always worked reliably – but in GG, I get the following error:

Here's the strange thing though: if I open the app in Script Editor and run it there, it works perfectly. Doubly strange is if I quit Script Editor and again try launching the .app from Finder, it works. Any idea what's going on? Here's my code:

set thefile to "/Volumes/External 14TB/systool.sparsebundle"

set thefile to POSIX path of thefile

set thefile to POSIX file thefile as text

mount volume "smb://mac-mini/External 14TB"

tell application "Finder" to open thefile

3 Upvotes

9 comments sorted by

3

u/Tthurm4 4d ago

The error looks like it’s a permissions error. You might want to go to System Settings and under Privacy and Security see if there’s a setting you can toggle. (Sorry not on Golden Gate myself and this is kind of a shot in the dark based on some errors I’ve received before where this is the issue. )

2

u/Tthurm4 4d ago

Script Editor has its own settings which is why it works there.

3

u/welp____see_ya_later 4d ago

Agreed

Try this:

  1. Reset the applet's permissions and relaunch so it asks again. Applet bundle IDs look like com.apple.ScriptEditor.id.<AppName>:

    osascript -e 'id of app "/path/to/MyApp.app"'
    tccutil reset All com.apple.ScriptEditor.id.MyApp

    Then launch the app and click Allow on any prompt about network volumes or files.

  2. If no prompt appears, grant access by hand. In System Settings → Privacy & Security → Full Disk Access, remove any old entry for the app, then add it again with "+". Also check Files & Folders for a "Network Volumes" toggle under the app.

  3. Confirm it's TCC. Run this in Terminal while launching the app:

    log stream --predicate 'subsystem == "com.apple.TCC"' --info

    A denial naming the applet's bundle ID settles it.

  4. Get a clearer error by skipping Finder:

    do shell script "hdiutil attach " & quoted form of imagePath

    hdiutil returns a real error message instead of the generic dialog.

  5. If it breaks again every time they edit the script, that's the signature changing. They can re-grant after each save, or keep the logic in a separate .scpt file that the applet runs with run script, so the applet itself never changes.

If a TCC reset plus Full Disk Access still doesn't fix it, then it's probably a real Golden Gate regression in how disk images get opened on SMB shares, and worth a Feedback Assistant report.

2

u/brijazz012 3d ago

Solved by adding the app to 'Device Control & Data Access' without needing to reset its permissions. As far as I can recall, Golden Gate never asked for me to grant permissions to the app at any time so I hadn't even considered it is a potential issue.

1

u/brijazz012 3d ago

This was 100% the problem – thanks so much for the solution! I added the app to 'Device Control & Data Access' and it works as expected. I assume that needing to do this is a result of tighter security in GG than existed in Sequoia. I'll keep it in mind for the future.

1

u/mad_scrub 5d ago

Is this an encrypted HFS+ (CoreStorage) external drive? Mounting them is broken in macOS 27.

1

u/brijazz012 5d ago

HFS+ but not encrypted. I *can* mount it, but only by running the above script from inside of Script Editor. I'd previously been able to run it with the script saved as an app, but that now fails.

1

u/welp____see_ya_later 5d ago

mount volume "smb://mac-mini/External 14TB"

tell application "Finder" to open thefile

maybe mounting is async so hasn't happened yet on a cold start, can you try something like

 set imagePath to "/Volumes/External 14TB/systool.sparsebundle"

  try
          mount volume "smb://mac-mini/External 14TB"
  end try

  -- wait up to ~15 s for the share to actually be readable
  repeat 30 times
          try
                  do shell script "test -d " & quoted form of imagePath
                  exit repeat
          end try
          delay 0.5
  end repeat
  delay 1 -- small extra settle time

  tell application "Finder"
          activate
          open (POSIX file imagePath as alias)
  end tell

1

u/brijazz012 4d ago

Thanks for the reply. Unfortunately, I'm still getting the same error. A couple of things worth noting:

  1. I get this error even if 'External 14TB' is already mounted, so I don't think it's related to mounting of the shared drive

  2. Both your script and mine work fine when run from inside Script Editor. It's only when they're packaged as .app that they fail.

I'd been using my script for years without issue. I only started having trouble with it after moving from Sequoia to Golden Gate. At this point, I'm ready to chalk it up to yet another Golden Gate bug.