Vagrant & VirtualBox shared folders: Getting symlinks to work on a Windows host

Jul 29, 2021 07:30 · 229 words · 2 minute read

TLDR: Activate the Windows feature “Create symbolic links”, then symlinks within Vagrant/VirtualBox shared folders will work. How-to:

For some of our projects, we are using Vagrant with VirtualBox on Windows. If you do the same, one thing you probably noticed is that you then cannot use symlinks within shared folders. This is especially annoying as dependency managers like npm and composer are sometimes symlinking a binary to from a package folder into node_modules/bin/<binary>. While workarounds exist (such as --no-bin-links in npm), this gets annoying & sometimes the workaround do not work.

Turns out - symlinks work just fine on a Windows host, but you need to activate the feature. You need to grant your Windows user the permission “Create symbolic links” (How-to: Please note: Activation has to be done by a user with admin privileges), log out and log in again ⇒ and symlinks within shared folders will just work (Vagrant automatically uses the feature, as documented in their docs) 😍

Windows symlink demo

Maybe you can now remove some of these ugly workarounds (I certainly could) 😁

Note of warning: There is a reason this feature is not activated for standard users - security. Enabling this feature has some security implications (which, in my opinion, are worth it if you are developing software). Please see this Microsoft documentation entry for information about the symlink feature & its security implications.