Skip to main content

Connecting Symlinks

Michael Cioni avatar
Written by Michael Cioni
Updated over 2 weeks ago

Connecting Symlink on MacOS (and Linux)

  1. Open Terminal

    • You’ll find it in Applications > Utilities > Terminal.

  2. Navigate to the directory where you want the symlink

    cd /path/to/desired/location
  3. Use the ln -s command
    Syntax:

    ln -s [TARGET] [LINK_NAME]
    • TARGET = the actual file or folder you want to link to.

    • LINK_NAME = the name (and location) of the symlink.

    Example:

    ln -s /Users/you/Documents/Projects/myproject /Users/you/Desktop/myproject_link
  4. Verify the link

    ls -l

    You should see the symlink with an arrow pointing to the target.

  5. Test it
    Opening the symlink should take you directly to the original file or folder.


Connecting Symlink on Windows

Windows has two main ways: Command Prompt (cmd) and PowerShell.

A. Using Command Prompt

  1. Open Command Prompt as Administrator

    • Press Win + S, type cmd, right-click, and choose Run as administrator.

  2. Use the mklink command
    Syntax:

    mklink [options] LINK TARGET

    Options:

    • /D → Directory symlink

    • /H → Hard link (files only)

    • /J → Directory junction

    Examples:

    • File symlink:

      mklink C:\Users\You\Desktop\notes.txt C:\Users\You\Documents\notes.txt
    • Directory symlink:

      mklink /D C:\Users\You\Desktop\ProjectLink C:\Users\You\Documents\Projects\MyProject
  3. Confirm it worked
    Navigate to the link in File Explorer—opening it should take you to the original.


B. Using PowerShell

  1. Open PowerShell as Administrator.

  2. Use New-Item
    Syntax:

    New-Item -ItemType SymbolicLink -Path "LINK" -Target "TARGET"

    Example:

    New-Item -ItemType SymbolicLink -Path "C:\Users\You\Desktop\ProjectLink" -Target "C:\Users\You\Documents\Projects\MyProject"

✅ Tips & Notes

  • On macOS/Linux, ln -s is the go-to.

  • On Windows, mklink requires Administrator by default, but Windows 10+ with Developer Mode lets you create symlinks without admin rights.

  • Hard links point directly to file contents (not folders), while symlinks are more flexible.

  • Junctions are a Windows-only type of directory link, often used for backwards compatibility.


Symlink Setup Comparison: macOS vs Window

Quick Takeaways

  • On macOS/Linux, ln -s is the universal command.

  • On Windows, use mklink in cmd or New-Item in PowerShell.

  • Windows offers junctions in addition to symlinks and hard links.

  • Enable Developer Mode (Windows 10/11) to create symlinks without admin rights.

Feature

macOS / Linux

Windows (Command Prompt)

Windows (PowerShell)

Command

ln -s TARGET LINK_NAME

mklink [options] LINK TARGET

New-Item -ItemType SymbolicLink -Path "LINK" -Target "TARGET"

File symlink

ln -s /path/file /path/link

mklink link.txt target.txt

New-Item -ItemType SymbolicLink -Path "link.txt" -Target "target.txt"

Directory symlink

ln -s /path/folder /path/link

mklink /D linkFolder targetFolder

New-Item -ItemType SymbolicLink -Path "linkFolder" -Target "targetFolder"

Hard link (file only)

ln target.txt link.txt

mklink /H link.txt target.txt

New-Item -ItemType HardLink -Path "link.txt" -Target "target.txt"

Junction (dir only)

N/A

mklink /J linkFolder targetFolder

New-Item -ItemType Junction -Path "linkFolder" -Target "targetFolder"

Permissions

Normal user rights

Requires Administrator (unless Developer Mode enabled)

Requires Administrator (unless Developer Mode enabled)

Verification

ls -l (shows link -> target)

dir (shows <SYMLINK> or <JUNCTION>)

`Get-Item link

Did this answer your question?