You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to create an alias from the command line

Hi
I would like to know how to create an alias (for a file, not a command) from the command line. I don't want to use the ln command, as an alias has more interesting features than soft/hard links... Is there an Apple specific tool to do this?

Thanks
-Jerome

Mac OS X (10.4.10)

Posted on Jul 13, 2007 7:26 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 13, 2007 8:59 AM

The only straightforward way that I am aware of for creating a "Finder" alias from the command line is using AppleScript via ' osascript'. Of course, it's not really a command line solution since the "Finder" has to be running. Anyway, something along the lines of:
<pre style="overflow:auto; padding: 5px; width: 500px ; font-size: 10px; border:1">osascript -e 'tell application "Finder" to make alias file to POSIX file "/full/path/to/file" at POSIX file "/full/path/to/folder"'</pre>
2 replies
Question marked as Top-ranking reply

Jul 13, 2007 8:59 AM in response to jeromedroz

The only straightforward way that I am aware of for creating a "Finder" alias from the command line is using AppleScript via ' osascript'. Of course, it's not really a command line solution since the "Finder" has to be running. Anyway, something along the lines of:
<pre style="overflow:auto; padding: 5px; width: 500px ; font-size: 10px; border:1">osascript -e 'tell application "Finder" to make alias file to POSIX file "/full/path/to/file" at POSIX file "/full/path/to/folder"'</pre>

How to create an alias from the command line

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.