Install ISIS on Mac

From Remeis-Wiki
Jump to navigation Jump to search

This instruction is intended for Mac OS X 11.6 (Big Sur) users to "completely" install ISIS including the modules for: gsl, xfig, isisscripts. It was tested on an Intel machine with both 11.6 (Big Sur) and 10.15 (Catalina). No tests were done with ARM machines.

Assuming a fresh Mac OS X 11.6 installation (alternatively make sure that /usr/local/ or the prefix path of the installation is empty).

1. Install Xcode (latest version) and Xquartz

To check whether Xcode is installed execute: \\

xcode-select -p

on command line

If you see /Applications/Xcode.app/Contents/Developer it should be installed. Use the App Store to update or install Xcode

Execute xcode-select --install on command line to install the Xcode command line tools

Xquartz / X11 is no longer included in the latest versions of Mac OS X and need to be installed separately. X11 is also no longer available from Apple directly, but has to be obtained from the web. Download X11 and install it. Note: if this link is out of date, search the Web for "OS X Xquartz". After installation the X11 libraries should now be available in /opt/X11/

2. Install Mac Ports or Homebrew

Fink could also work, the differences should be some package names and the location of some libraries which should be /opt/local/ for Mac Ports or /sw/local/ for Fink.

This instruction assumes that Mac Ports is installed. It is also possible to use Homebrew.

3. Install packages with Mac Ports

There are several packages including their dependencies to be installed. I recommend installing everything with the universal flag set (which includes 32bit and 64bit versions) on older macOS versions, otherwise it is not necessary. You can also use homebrew. First update port and all packages

sudo port selfupdate
sudo port upgrade outdated # repeat this until it does nothing
sudo port install gcc12
sudo port install gsl
sudo port install fig2dev
sudo port install z
sudo port install git
sudo port install texlive # only if latex is not available yet
sudo port install texlive-latex-extra # if sltikz will be used

These packages install a necessary gfortran compiler as well as necessary libraries to build the slgsl / slxfig module for slang / isis. To make sure that the proper compilers are used (and not /usr/bin/gcc, which is a only "frontend" that can parse gcc), set the following in your ~/.bash_profile:

export GCC="/opt/local/bin/gcc-mp-12"
export CC="/opt/local/bin/gcc-mp-12"
export CXX="/opt/local/bin/g++-mp-12"
export FC="/opt/local/bin/gfortran-mp-12" # mac ports gfortran compiler

Then type source ~/.bash_profile in the terminal.

4. Install HEADAS

This is not necessary if only the "stellar_isisscripts" will be used.

  • Download the latest version of HEASOFT (source)
  • Up until HEASOFT 6.15, XSPEC did not work properly on Mac OS X in 64bit mode. As of HEASOFT 6.16 this is no longer the case and the recommendation is to install everything in 64bit. You don't need to set anything to do that, but if you have old compiler flags set to "-m32", remove them!
  • create a directory in your $HOME called Software
  • unpack the HEADAS tar file in this directory
  • Install HEASOFT from source but use the following configurations
 ./configure --x-libraries=/opt/X11/lib --x-includes=/opt/X11/include
make
sudo make install
  • Add the following to your ~/.bash_profile (change this according to your terminal type and username)
export HEADAS="/Users/username/path/to/heasoft/"
alias heainit="source $HEADAS/headas-init.sh
heainit

The HEADAS path could/should look something like this:

$HEADAS=/Users/chgross/Software/heasoft-6.16/x86-apple-darwin14.1.0/
  • apply the new settings to your terminal by either closing the current terminal windows and open a new terminal or by writing

source ~/.bash_profile in your command line

5. Install slang / slang modules / isis / isisscripts

First get the latest versions of slang / jed/ slgsl / slxfig / slirp / isis / isisscripts. I recommend using the git repositories. Go to the Software directory in your terminal and clone the repositories:

git clone https://github.com/houckj/isis
git clone git://git.jedsoft.org/git/slang.git
git clone git://git.jedsoft.org/git/slxfig.git
git clone git://git.jedsoft.org/git/slgsl.git
git clone git://git.jedsoft.org/git/jed.git
git clone git://git.jedsoft.org/git/slirp.git
git clone http://www.sternwarte.uni-erlangen.de/git.public/isisscripts 

Install slang. Go to the slang directory.

./configure --with-png=/opt/local/
make
sudo make install

Install isis. Go to the isis directory

./configure --with-headas=$HEADAS
make
sudo make install

If your aim is to install the "stellar_isisscripts", you don't need HEADAS and you can instead do:

sudo port install wget
sudo port install pgplot
sudo port install cfitsio 
./configure --with-pgplot=/opt/local/ --with-cfitsio=/opt/local/ --with-x=/opt/X11/
make
sudo make install

Add --with-slang=/path/to/slang to the following configuration set ups in case you installed slang in a different path other than /usr/local/

Install jed. Go to the jed directory

./configure --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib
make clean
make
sudo make install

Install slgsl. Go to the slgsl directory

./configure --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib --with-gsl=/opt/local/
make
sudo make install

Install slxfig. Go to the slxfig directory

./configure --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib
make
sudo make install

Install slirp. Go to the slirp directory

./configure
make
sudo make install 

Before building the isisscripts, install the "SLURP" perl module.

sudo perl -MCPAN -e shell
install CPAN
reload cpan
install File::Slurp
quit

Then go to the isisscripts directory and

make

Create / modify the .isisrc file in your $HOME directory and add the following line

add_to_isis_load_path("/Path/To/isisscripts/share/");
define ris() { require("isisscripts"); };

This allows the easy access to require("isisscripts") in isis.

(6. Install stellar_isisscripts)

Get the newest version of the stellar_isisscripts from git. If you have a Remeis/gitlab account and are at the Remeis observatory, do:

git clone git@serpens.sternwarte.uni-erlangen.de:irrgang/stellar.git
mv stellar stellar_isisscripts

If you have a Remeis/gitlab account and are not at the Remeis observatory, do:

git clone http://www.sternwarte.uni-erlangen.de/gitlab/irrgang/stellar.git
mv stellar stellar_isisscripts

Otherwise ask Matti Dorsch. Then:

cd stellar_isisscripts
make 

Now compile some necessary C functions:

cd stellar_isisscripts/slirp
slirp -make -lm -lgsl -lgslcblas -lpthread c_functions.h c_functions.o
sed -i -e 's/^CFLAGS[[:space:]]*= -g -O2/CFLAGS = -g -Ofast -Wall -Wextra/g' Makefile 

In the Makefile, change these two lines to read:

SLANGINC        = -I/usr/local/include -I/opt/local/include
SLANGLIB        =  -L/usr/local/lib -L/opt/local/lib -lslang 

Also make sure that the newest version of gcc-mp is used, e.g. gcc-mp-12. Then:

make
make test
rm c_functions-test.sl ; rm c_functions.o ; rm c_functions_glue.o ; rm c_functions_glue.c ; rm Makefile ; rm *~ 

Edit the .isisrc file in your $HOME directory and add the following lines

add_to_isis_load_path("/Path/To/stellar_isisscripts/share/");
define rmy() { require("stellar_isisscripts"); };

To use all functions, you need the stilts tool, which is related to TOPCAT

mkdir stilts; cd stilts
wget http://www.star.bris.ac.uk/~mbt/stilts/stilts.jar
wget 'http://www.star.bris.ac.uk/~mbt/stilts/stilts'
chmod +x stilts
sudo cp * /opt/local/bin  

To test if the scripts work, try for example:

isis
rmy;
s = query_photometry ("HZ44");
s.print();
help query_photometry
q
exit;

7. Possible problems with other software

XMM SAS

The XMM SAS resets part of your $PATH variable and uses its some of its own libraries. This might break some programs of HEASOFT when the SAS is loaded. As our xmmscripts rely on the ftools, this behavior is highly inconvenient. As a workaround install the HEASOFT wrapper by following the instructions here.

This will create a new directory with the executables of HEASOFT. Add this directory to your $PATH variable (in front of the rest of $PATH)!