Взгляните на Как программно создать псевдоним .
- (void)makeAliasToFolder:(NSString *)destFolder inFolder:(NSString *)parentFolder withName:(NSString *)name
{
// Create a resource file for the alias.
FSRef parentRef;
CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath:parentFolder], &parentRef);
HFSUniStr255 aliasName;
FSGetHFSUniStrFromString((CFStringRef)name, &aliasName);
FSRef aliasRef;
FSCreateResFile(&parentRef, aliasName.length, aliasName.unicode, 0, NULL, &aliasRef, NULL);
// Construct alias data to write to resource fork.
FSRef targetRef;
CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath:destFolder], &targetRef);
AliasHandle aliasHandle = NULL;
FSNewAlias(NULL, &targetRef, &aliasHandle);
// Add the alias data to the resource fork and close it.
ResFileRefNum fileReference = FSOpenResFile(&aliasRef, fsRdWrPerm);
UseResFile(fileReference);
AddResource((Handle)aliasHandle, 'alis', 0, NULL);
CloseResFile(fileReference);
// Update finder info.
FSCatalogInfo catalogInfo;
FSGetCatalogInfo(&aliasRef, kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL);
FileInfo *theFileInfo = (FileInfo*)(&catalogInfo.finderInfo);
theFileInfo->finderFlags |= kIsAlias; // Set the alias bit.
theFileInfo->finderFlags &= ~kHasBeenInited; // Clear the inited bit to tell Finder to recheck the file.
theFileInfo->fileType = kContainerFolderAliasType;
FSSetCatalogInfo(&aliasRef, kFSCatInfoFinderInfo, &catalogInfo);
}
Вы также можете использовать яблочный скрипт
osascript -e 'tell application "Finder" to make alias file to POSIX file "/Applications/myapp.app" at POSIX file "/Applications/"'