Skip to main content

Symlink issues with Vagrant and Composer

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer
Head of IT Business Operations

Recently we converted one of project to use Vagrant Rsync Folders instead of the default VirtualBox shared folder setup. After running the vagrant rsync-auto command for a while we realized that the symlinks in Composers ./vendor/bin/ where replaced with the content of the previously symlinked files. This made the commands unusable.

After a bit of investigation it was clear what was happening: Vagrant does not by default pass the -l flag to rsync which means symlinks are not preserved (even though the vendor folder was not copied to the guest vm). To fix this we had to adjust the rsync options by setting the rsync args for the folder to:

["--verbose", "--archive", "--delete", "-z", "-l"]