macOS doesn’t have a local drag and drop methodology to create a symlink in the identical method as creating an alias in Finder. By default, symlinks are created through the use of ln
from the command line in Terminal.
In Terminal:
$ ln
utilization: ln [-Ffhinsv] source_file [target_file]
ln [-Ffhinsv] source_file ... target_dir
hyperlink source_file target_file
$
For added particulars, use: man ln
For a homegrown answer utilizing Automator and AppleScript, the next is a bare-bones instance of an Automator Service (QuickAction in macOS Mojave) that when assigned a keyboard shortcut, e.g. ⌘S in System Preferences > Keyboard > Shortcuts > Companies, will create a symlink of the chosen objects in Finder on the chosen vacation spot folder that’s introduced up by urgent e.g. ⌘S:
This Service (QuickAction) shall be out there on the Companies menu in Finder or from right-click Context menu, and or the assigned keyboard shortcut as soon as an merchandise or objects are chosen in Finder.
Naked-bones instance AppleScript code:
on run {enter, parameters}
if enter is the same as {} then return
activate
set posixPath to POSIX path of (select folder with immediate ¬
"Choose vacation spot folder for Symlink..." default location ¬
(path to desktop folder) with invisibles)
repeat with thisItem in enter
set thisItem to POSIX path of (thisItem as alias)
attempt
do shell script "ln -s " & quoted type of thisItem & ¬
area & quoted type of posixPath
finish attempt
finish repeat
finish run
The instance AppleScript code assumes you’ve write privileges on the chosen vacation spot folder, different then the chosen objects supply folder, and as coded solely creates the symlink if it would not exist already. Modifications could be made to the code to accommodate different choices.
Notice: The instance AppleScript code is simply that and, different then a single attempt
assertion, doesn’t comprise any extra error dealing with as could also be acceptable. The onus is upon the consumer so as to add any error dealing with as could also be acceptable, wanted or needed. Take a look on the attempt assertion and error assertion within the AppleScript Language Information. See additionally, Working with Errors.