using FITSIO in Octave-FITS under Cygwin

less than 1 minute read


  • Consider transitioning Cygwin workflows to Windows Subsystem for Linux for better performance and usability in a full Ubuntu terminal inside Windows.
  • Long term, consider switching to Python for wider community acceptance and easy FITS reading

  1. Install Cygwin prereqs from Windows Command Prompt
    setup-x86_64 -P libcfitsio-devel make pkg-config gcc-g++ libgfortran3 libGraphicsMagick3 octave octave-devel texinfo
  2. From Cygwin, in Octave, type
    pkg install -verbose -forge fits

    This should install FITS without errors.

Load .fits

pkg load fits

enable FITS read/write functions. Note, the command is NOT fitsread(), in Octave the FITS read command is read_fits_image().

Tested with Octave 4.2, FITS 1.0.7

cfitsio compile

This is not necessary, just for reference.


tar -xf cfitsio*.tar.gz

cd cfitsio
./configure --enable-reentrant --enable-ssse3

make && make install

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Fix Errors

If you get an error message upon ./configure

gcc/g++ can’t be found

to fix, in Cygwin type

unset CC

then retry your ./configure command

Leave a comment