Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. Join us in person at the ninth annual Jamf Nation User Conference (JNUC) this November for three days of learning, laughter and IT love.

create alias through the terminal with a custom filename

Hey Everyone,

We placing symlinks on the desktop to a few mounted network shares to give the ability to save files to symlink on the desktop. We just noticed office 2011 on osx 10.8.5 doesn't seem to follow symlinks in the save dialog.

Aliasses do seem to work but we'd like to customize the name of the alias that is created like we are doing with symlinks (our sharenames don;t make sense to our end users and renames the shares isn't an option).

Im using the following command in a terminal to create an alias to a mounted networkshare

#!/bin/sh

osascript -e 'tell application "Finder" to make alias file to posix file "/Users/username/Library/ShareMounts/sharename" at desktop '

Applescript/Osascript isn't my area of expertise and google hasn't been helpful so far. Does anyone know of a way to specify a name when creating a alias?

Like Comment
Order by:
SOLVED Posted: by mm2270

There may be a simpler way to have it all on one line, but the following seems to work

tell application "Finder"
    set mySource to POSIX file "/Users/Shared" as alias
    make new alias to mySource at desktop
    set name of result to "MyAlias"
end tell

You could wrap it into a HEREDOC format, like so:

/usr/bin/osascript << EOF
tell application "Finder"
set mySource to POSIX file "/Users/Shared" as alias
make new alias to mySource at desktop
set name of result to "MyAlias"
end tell
EOF
Like
SOLVED Posted: by Abdelhafid

Thanks you much. I'll give this a try first thing in the morning and get back to you :D

Like
SOLVED Posted: by Nix4Life

whoops wrong window, disregard
LS

Like