Last Updated: February 25, 2016
·
682
· kennybrijs

Symlinking a folder with content (mac)

Found this one confusing every time I needed it, so decided to write it down once and for all.

Example:

You want to link a copy of a projectfolder with a website in your htdocs folder of MAMP. This way, you can keep all your projects together in one folder and still serve that project in your htdocs folder.

Requirements:

Your project folder (e.g. /Users/username/Documents/work/projectX).
A folder to put the symlink in (e.g. your htdocs folder in MAMP: /Applications/MAMP/htdocs).

The command:

ln -s /Users/username/Documents/work/projectX /Applications/MAMP/htdocs

First directory is the source folder, second directory is the target folder

No trailing slashes behind the directories

(/Users/.../projectX, not /Users/.../projectX/)

Use absolute paths, not relative to your current folder location