Create symbolic links in OSX
Symbolic links, or symlinks as they are also known. They can be seen as an alias, they are nothing more than "symbolic" paths that can point to any location on your computer, they are useful when you want to keep directories separate, but at the same time one inside the other. For example, if I have a repository with these files:
1- public2-- wp-content3-- .gitignore4-- composer.json5-- README.md6
And I want the wp-content
directory, within an installation with existing files:
1- public2-- wp-admin3-- wp-includes4-- wp-config.php5...6
I couldn't just clone the repository, since the directory wouldn't be empty,
then, the solution would be to create a symbolic path with the ln
command.
Its syntax is as follows:
1ln -s path/original path/symbolic2
The -s
parameter is what specifies that it is a symbolic link, in most cases
you won't need anything else. Now my installation would look like this:
1- public2-- wp-admin3-- wp-content4-- wp-includes5-- wp-config.php6...7
Where wp-content
is a reference to the original path, and by entering that
directory I will simply enter the original, so every time I update the
repository I will get the updates also in my installation.