Finder got an error: Can’t make class alias file. (-2710)

Contributor III

OK -- I have an iMac and MacBook Air both running 10.14.2.

I have a script that creates some ALIAS files on Desktop to a FileShare.

My script works on the iMac great but I get this error on MacBook Air:

456:501: execution error: Finder got an error: Can’t make class alias file. (-2710)

Here is part of my script that is defining the paths and creating alias files:

set Cloud to POSIX file "$SMBHomeDirectory"
set Public to POSIX file "/Volumes/share"
set Staff to POSIX file "/Volumes/path/here"
set Class to POSIX file "/Volumes/path2/here"

tell application "Finder"
    make new alias file at desktop to Cloud
    set name of result to "Cloud"

    make new alias file at desktop to Public
    set name of result to "Public"

    make new alias file at desktop to Staff
    set name of result to "Staff"

    make new alias file at desktop to Class
    set name of result to "Class"
end tell

Any thoughts on this would be appreciated. Throwing me for a loop since it works on 1 machine but not another.

Thank you in advance.


Valued Contributor

Are there any differences in PPPC profiles that are installed, or differences in user-approved apps under System Preferences>Security & Privacy>Privacy?

Osascript and/or Terminal might need to be whitelisted to control Finder.

Contributor III

@sshort Everything appears to be the same. My script is actually a .app file I created that I used the PPPC Utility to create a mobileconfig to whitelist it. Previously it was asking to "allow" my app since it wanted to control finder. Once I created the new profile, scoped, it's suppressed that dialogue box and seems to work great.

What's odd is I created a simple script to create Aliases to local folders like "Desktop, Docs, & Downloads" using the same method.

It created the desktop alias but gave me same error with documents and downloads! Like what the heck

EDIT: When I was testing the simple one I made...I was using ARD to send the script > thus having to whitelist ARD: Finder > Under "Automation" in the Sec & Privacy > Privacy > Automation Tab...then it allowed me to execute the script

Contributor III

Starting to see this again randomly on machines upgraded from 10.11.6 to 10.14.6

anyone have any insight? Am i creating those alias's correctly?

Contributor II

Is there any chance there are home directory permissions problems? If so, you may want to script a permissions repair before running your script. Something like:

diskutil resetUserPermissions / 501

...where 501 is the uid being repaired.

Contributor III

@endor-moon I'm wondering if this is the case I will check -- It appears this happens only on machines that are upgraded from older macOS versions like 10.11.6 to 10.14.6 etc. Do you know of a system variable to snag that UID ? I can do some reading and grep for it just didn't know if there was one like there is for $LOGNAME etc.