Dragging a folder in Finder while pressing Command + Option (⌘ + ⌥) creates an alias. But is there a quick and similar way to create a symlink this way?
MacOS – Quick way to create a symlink
findermacos
Related Question
- Can the Finder be tricked into assigning symlinks and aliases different icons
- Way to force Finder to attempt to move something from a read-only folder
- MacOS – How to create an alias with drag and drop
- MacOS – How to create a modifier shortcut to drag files into a new folder
- Stop Finder from creating aliases when moving Applications
- MacOS Cannot Create Valid Symlink From Terminal Using Relative Paths
Best Answer
macOS does not have a native drag and drop method to create a symlink in the same manner as creating an alias in Finder. By default, symlinks are created by using
ln
from the command line in Terminal.In Terminal:
For additional details, use:
man ln
For a homegrown solution using Automator and AppleScript, the following is a bare-bones example of an Automator Service (QuickAction in macOS Mojave) that when assigned a keyboard shortcut, e.g. ⌘S in System Preferences > Keyboard > Shortcuts > Services, will create a symlink of the selected items in Finder at the selected destination folder that is brought up by pressing e.g. ⌘S:
This Service (QuickAction) will be available on the Services menu in Finder or from right-click Context menu, and or the assigned keyboard shortcut once an item or items are selected in Finder.
Bare-bones example AppleScript code:
The example AppleScript code assumes you have write privileges at the selected destination folder, other then the selected items source folder, and as coded only creates the symlink if it doesn't already exist. Changes can be made to the code to accommodate other options.
Note: The example AppleScript code is just that and, other then a single
try
statement, does not contain any additional error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.