FITSIO in Octave-FITS under Cygwin

Rather than fiddle with this procedure, we would suggest using Python in general for data analysis, including reading FITS files.

Install Cygwin prereqs from Windows Command Prompt

setup-x86_64 -P libcfitsio-devel make pkg-config gcc-g++ libgfortran3 libGraphicsMagick3 octave octave-devel texinfo

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


  • 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