How to use fish shell in cygwin?

Solution 1:

fish shell 2.1.0 is now officially supported in Cygwin, it's possible to install it using the default installer.

Solution 2:

Here's how I managed to compile fish in Cygwin.

Step 1: Check that all dependencies are installed

First, make sure we have the following cygwin packages:

  • libncurses-devel
  • libiconv
  • autoconf (not a really a dependency of fish, but we need it for a later step)

Step 2: Download and extract the latest source

Next, download the latest source from http://fishshell.com (I used fish-1.23.1.tar.gz). Extract the source to your directory of choice and cd to it:

$ tar zxvf fish-1.23.1.tar.gz -C /usr/local/src/
$ cd /usr/local/src/fish-1.23.1/

Step 3: Edit configure.ac to remove checks for iconv

Now for some reason, ./configure cannot detect libiconv properly. To get around the problem we remove the check for it (we'll specify the lib manually later). To do so, we edit configure.ac and remove checks for iconv_open. Searching for iconv_open reveals 3 occurences; we comment them all out. So, from:

AC_SEARCH_LIBS( iconv_open, iconv, ....)

We change to:

#AC_SEARCH_LIBS( iconv_open, iconv, ....)

Step 4: Rebuild and run ./configure

Next, we rebuild the ./configure script by running autoconf then run the configure script:

$ autoconf && ./configure

Step 5: Edit Makefile to include correct path to curses.h

Another problem I faced was with curses.h -- gcc couldn't find it. A quick search revealed that it's in /usr/include/ncurses.

The Makefile has a hardcoded include path for it in CFLAGS, but it points to /usr/local/include/ncurses instead.

So, we edit Makefile and change:

CFLAGS = -I/usr/local/include/ncurses -std=c99 ....

to

CFLAGS = -I/usr/include/ncurses -std=c99 ...

Step 6: Export LDFLAGS to link in libiconv, and we're ready to compile/install.

Finally, we export the necessary LDFLAGS to link in iconv, then compile and install!

$ export LDFLAGS="-liconv"
$ make && make install

Enjoy fish

$ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
me@home /u/l/s/fish-1.23.1>