3

I'm battling with cygwin for quite a while now.
I searched far and wide on how to make cygwin create Windows-style symbolic links.

I tried the following:

export CYGWIN="winsymlinks:native"
export CYGWIN="winsymlinks:nativestrict"
export CYGWIN="winsymlinks:lnk"
  • I also tried exporting w/o the quotes.
  • I also tried from both cygwin/x86 and cygwin/x64

For the life of me - I can't get the Windows native symlinks to work. I'm working on Windows7/64bit; cygwin version 1.7.25.

I'd love to get a solution for this one.

Thank you.

AVIDeveloper
  • 2,954
  • 1
  • 25
  • 32
  • User [olibre](http://stackoverflow.com/users/938111/olibre) has already posted an informative answer on [using Cygwin to create native symlinks](http://stackoverflow.com/a/18659632/1640661). – Anthony Geoghegan Jul 08 '14 at 16:11

3 Answers3

7

I got the same problem. In my case, I used winsymlinks:nativestrict and received an error report saying: Operation is not permitted.

This is becase of Windows UAC and the terminal emulator not being started with elevated privileges. So I run Cygwin mintty as administrator (you can right click the shortcut and choose "Run as administrator" or set the mintty shortcut property: Advanced -> Run as Administrator). After that, everything just works perfectly.

Anthony Geoghegan
  • 11,533
  • 5
  • 49
  • 56
Liyu Gong
  • 79
  • 1
  • 2
  • 1
    some formatting would make this easier to read. nice answer! – Martin Serrano Apr 10 '14 at 02:01
  • 1
    This should have been the accepted answer. I upvoted it and edited to improve readability while clarifying that the terminal emulator should be started with elevated privileges. – Anthony Geoghegan Jul 08 '14 at 15:25
  • ok, but how do you actually start rsyncd in such a way that it will create junctions instead of cygwin symlink or .lnk files, I can get them to work over ssh with winsymlinks:native or winsymlinks:nativestrict for some reason but not with rsync. I tried modifying the uid = in /etc/rsyncd.conf to Administrator, cyg_server, and even SYSTEM (SYSTEM caused the system to crash and reboot), but no luck – sabujp Jan 26 '17 at 23:11
  • don't run as administrator, just assign the privilege to your user – CervEd Oct 20 '22 at 08:37
4

I also battled with this one for a while on Windows 7 with Cygwin.

Everything I read seemed to say that it needed export CYGWIN="winsymlinks:native", but no luck for me.

Then I read this blog http://zzamboni.org/blog/making-cygwin-windows-and-emacs-understand-th/ which said that just "winsymlinks" was all you need. Tried that and it worked beautifully :)

Just use this environment variable. export CYGWIN="winsymlinks"

JeremyB
  • 185
  • 4
  • 2
    I actually gave up the whole idea and switched to Ubuntu, but I'll accept your answer for the chance it will help somebody in the future. – AVIDeveloper Dec 07 '13 at 13:55
  • The next answer is more likely the solution, turn off UCA and give your user Administrator in Windows is needed to make native symlinks – johnnyB Jun 14 '14 at 15:23
  • Actually, I think the next answer is a slightly different issue. I didn't have any problems with it being because of Administrator rights (I tried running as administrator as well with no luck). Different situations for different setups though, original user could have had either issue, but they gave up trying unfortunately :) – JeremyB Jul 14 '14 at 03:41
  • 4
    `export CYGWIN="winsymlinks"` is the same as `export CYGWIN="winsymlinks:lnk"` which creates Windows shortcuts as opposed to native NTFS symbolic links. According to [The CYGWIN environment variable](https://cygwin.com/cygwin-ug-net/using-cygwinenv.html), *if set to just winsymlinks or winsymlinks:lnk, Cygwin creates symlinks as Windows shortcuts with a special header*. – Anthony Geoghegan Oct 03 '14 at 16:39
1

Expect it to work with Windows 10 Creator update when you enable developer mode

Something to consider:

https://github.com/git-for-windows/git/wiki/Symbolic-Links

  • Symbolic links are only available on Windows Vista and later, most notably not on XP
  • You need the SeCreateSymbolicLinkPrivilege privilege, which is by default assigned only to Administrators and guarded by UAC, but can be assigned to other users or user groups (see below).
  • Symbolic links on remote filesystems are disabled by default (call fsutil behavior query SymlinkEvaluation to find out)
  • Symbolic links will only work on NTFS, not on FAT nor exFAT
  • Windows' symbolic links are typed: they need to know whether they point to a directory or to a file (for this reason, Git will update the type when it finds that it is wrong)
  • Many programs do not understand symbolic links
gavenkoa
  • 45,285
  • 19
  • 251
  • 303