Mac Software Hints

The following works on most recent versions of OSX (I'm currently using 10.14). There are issues with 10.15+ in that 32-bit code doesn't work. I have updated the Installing IRAF section to deal with that.


 

Upgrading to El Capitan/Sierra/HighSierra/Mojave

Upgrading to El Capitan/Sierra/HighSierra from Yosemite was pretty painless. If you're upgrading to High Sierra or Mojave from one of the others, it's even easier---just do the items marked with a *. The main problem is that Apple has intorduced a new security feature that prevents even "sudo" commands from altering anything deemed "system." Very unfortunately, /usr/local is considered system and is protected. So, step A: disable this feature long enough to change the permissions on /usr/local. If you're paranoid, then turn them back on. Here's what you do after installing El Capitan/Sierra/HighSierra/Mojave

  1. Turn off Syste Integrety Protection (SIP):
  2. sudo mkdir /usr/local ; sudo chflags norestricted /usr/local ; sudo chown yourself:admin /usr/local ; sudo chown -R yourself:admin /usr/local
  3. *sudo ln -s /opt/X11 /usr/X11R6 [necessary for any of the X11IRAF stuff to work]
  4. sudo ln -s /opt/X11 /usr/X11
  5. Make sure that /usr/include exists. If not, sudo mkdir /usr/include
  6. If you're going to ever compile the cmfgen version of pgplot, find a version of stdint.h and put it in /usr/include. Here is a copy
  7. *While you're at it, do an xcode-select --install
  8. Fix ssh:
  9. *Re-run the install task in IRAF:
  10. If you want SIP back on, go back into recovery mode, and do a "csrutil enable" I didn't do this on my machine, so I haven't tested if there are additional problems.
  11. Open up TeXShop and let it download the latest version (3.61).
  12. Take this opportunity to dowload the latest X11 from the X11 Quartz site.
  13. Download and install the latest XCODE. Open it and agree to install the additional stuff.
  14. Settings->General-->Show scroll bars "always". Jeez.
  15. For the pgfortran compiler to work, you need to do a: sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.o /usr/lib/crt1.o
  16. *ftp has disappeared in High Sierra/Mojave. See below for what to do about that.

 

Setting up a New Mac (Catalina!)

  1. Do a software update
  2. Associate MAC address with name
  3. Get X11 from XQuartz
  4. Change the default shell to tcsh
  5. Change some things
  6. sudo ln -s /opt/X11 /usr/X11R6
  7. sudo ln -s /opt/X11 /usr/X11
  8. install Xcode from App Store
  9. xcode-select --install
  10. Fix ssh:
  11. Install ds9
  12. Install Super Mongo
  13. Install TeXShop and TeX
  14. If you want to do the whole aasTeX thing and have LaTeX find them no matter where you are....
  15. Install FORTRAN
  16. Install IRAF

 

Installing IRAF

Things have gotten to be a mess, now that NOAO is no longer distributing IRAF. Furthermore, Catalina (10.15) and higher doesn't support 32-bit code. There are three viable options depending upon whether or not you are using 10.15+ or lower, and whether or not you need stsdas.

  • If you're running Catalina (10.15) or higher:
    1. There is a "iraf-community" version that is a modified version of 2.16.1 available via github; see this link. However, stsdas is not part of the distribution. Their instructions work well. Here's what I did:
      • Download their snapshot from here (go to the bottom of the page, and click on Source code (tar.gz)).
      • mkdir iraf [somewhere]
      • sudo chmod a+w iraf
      • cd iraf
      • sudo move the snapshot here. gunzip it, if necessary
      • tar zxf iraf-2.16.1+201811.01.tar [for instance]
      • sudo ln -s iraf-2.16.1+201811.01 iraf
      • chmod a+w iraf*
      • ./install Make sure the install location is good.
      • make macintel
      • make sysgen 2>&1 | tee build.log [this is where all the action is]
      • ./test/run_tests (an "xfail" means it was an eXpected failure....) I usually get 2 of these, and 124 passes. I live dangerously.
      • Next, you need xgterm: Go to here and go to Distribution Files, and click on the link. The instructions almost but didn't quite work. Here's what you need to do:
        • tar xzf x11iraf-2.0+2020.06.15.tar.gz (or whatever)
        • cd x11-2.0-2020.06.15 (or whatever)
        • bash
        • sudo CFLAGS=-Wno-error=implicit-function-declaration make install
    2. If you do need stsdas or tables there are two other options:
      • Use Tim Pickering's docker system: https://github.com/tepickering
      • Install Parallels and Ubuntu and install a bootlegged copy of iraf or the snake:
        • Anaconda:
          • Go to https://www.anaconda.com/download and download the 3.7 installer.
          • When all of that is done, source .bash_profile
          • which conda should return something
          • conda config --add channels http://ssb.stsci.edu/astroconda
          • conda config --add channels http://astroconda.gemini.edu/public
          • conda create -n geminiconda python=2.7 gemini stsci iraf-all pyraf-all
          • cd
          • conda activate geminiconda
          • mkdir iraf27a
          • cd iraf27a
          • mkiraf
          • cl should invoke iraf; pyraf should invoke PyRAF, and python starts singing I'm a Lumberjack.
          • You might want to add on the CR rejection softare; see The Manual.
          • Subsequent times:
            • Starting up IRAF
            • Open an xgterm window
            • conda activate geminiconda
            • which cl
            • cl
            • When done, conda deactivate
        • Bootlegged copy. If, say, somewhere left a a tar file of their installation lying around, say like this one one could do the following:
          • sudo mkdir /iraf
          • cd /iraf
          • mv that illicit PhilsIraf.tar.gz here.
          • gunzip PhilsIraf.tar.gz
          • tar -xvf PhilsIraf.tar
          • setenv IRAFARCH macintel
          • setenv iraf /iraf/iraf/ [with apologies to Karen]
          • sudo /iraf/iraf/unix/hlib/install.csh
          • take the defaults (generally speaking)
          • You'll also want to install the X11IRAF stuff (such as xgterm)
            • You could grab this file.
            • gunzip x11iraf-v2.0BETA-bin.macintel.tar.gz
            • tar -xvf x11iraf-v2.0BETA-bin.macintel.tar
            • sudo ./install [take the faults]
            • sudo cp -r app-defaults /opt/X11/lib/X11/.
            • cd ..
          • Set up and test:
            • cd
            • mkiraf
            • Create a loginuser.cl file that contains the following: reset use_new_imt=no
            • xgterm &
            • In the new window: cl
            • implot dev$pix

     

    Installing the Astrometry.net software

    Things have gotten a lot easier to install. I found once I brought up Homebrew, I could install with only minimal head-bashing:
    1. Download and install Homebrew by:
      • bash
      • ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
      • exit
      • Do a 'brew doctor' and try to make it happy. Brew hates having macports, fink, or any librariespresent in /usr/local/bin that it doesn't already know about. This may be very childish of it, but you can hide your libraries and macports and fink by sticking them in temporary files that you can then put back when you've got astrometry.net working. Keep running 'brew doctor' and doing what it requests until you finall get a 'ready to brew' message.
    2. brew install astrometry-net
    3. Follow the instructions when it gets stuck on something.
    4. One problem with version 72 is a conflict with Pyfits; need to do a: sudo pip install fitsio after first downloading and installing pip (see https://pip.readthedocs.io/en/stable/installing/ You'll have to do this as sudo).
    5. Install the indicies.
      • Download the 2MASS indicies, the TYCHO indicies and the USNO-B1.0indicies and stick them somewhere where you have a spare 65Gb of space.
      • Edit the /usr/local/Cellar/astrometry-net/etc/astrometry.cfg file to reflect where you've put the indicies, i.e., something like this:
        # In which directories should we search for indices?
        add_path /Volumes/pepe/astromindicies/2MASS-indicies
        add_path /Volumes/pepe/astromindicies/TYCHO-indicies
        add_path /Volumes/pepe/astromindicies/USNO-indicies 
        
    6. Add /usr/local/astrometry/bin to your path
    7. Try it on a test image:
      • solve-field --overwrite --scale-units arcsecperpix --scale-low 0.44 --scale-high 0.46 --ra 23.33 --dec 29.27 --radius 0.5 121028-987.fits
      • solve-field --overwrite --scale-units arcsecperpix --scale-low 0.43 --scale-high 0.44 --ra 84.0 --dec -69.2 --radius 0.5 n2044test.fits
      • solve-field --overwrite --scale-units arcsecperpix --scale-low 0.23 --scale-high 0.25 --ra 179.8 --dec 12.3 --radius 0.1 lmi.0079.fits
      • solve-field --overwrite --scale-units arcsecperpix --scale-low 0.43 --scale-high 0.44 --ra 92.08 --dec -71.96 --radius 0.3 --tweak-order 1 --no-plots --use-sextractor -N LMC000iCIIt1.fits LMC000iCII.fits
      • Can add:
        • --use-sextractor
        • --no-tweak or --tweak-order 1
        • --no-remove-lines (very useful when it won't solve). Should probably be the default.

     

    Sextractor

    1. brew install brewsci/science/sextrator

     

    CMFGEN

    CMFGEN is John Hillier's wonderful radiative transfer code for hot stars with stellar winds. The care and feeding of the code is beyond the scope of the current notes. Hese are some hints that should help in getting in getting the code up and running.
    1. You will seriously need to buy the PGF95 compiler.
      • Hints in getting the damn license server to work:
        • You **may** be able to just get by doing a "lmreread"
        • In getting the permanet license, first do a "lmutil lmhostid" to see which MAC address the damn thing is picking up.
        • Starting up the license daemon:
          • sudo bash
          • cd /opt/bin/osx86-64/2018/bin
          • sudo cp com.pgroup.flexlm.plist /Library/LaunchDaemons
          • sudo chown root:wheel /Library/LaunchDaemons/com.pgroup.flexlm.plist
          • sudo chmod 0644 /Library/LaunchDaemons/com.pgroup.flexlm.plist
          • sudo launchctl load /Library/LaunchDaemons/com.pgroup.flexlm.plist.
          • When that fails, just do a /opt/pgi/osx86-64/18.3/bin/lmgrd
          • Recently I've been trying this and getting a message about not being able to open a port. Turns out that here was some conflict with the idl83 lmgrd. Do a ps -ax | grep lmgrd. Now...if you just kill it, it will restart. So, I did something more draconian and did a mv of the executible in the IDL directory to lmgrdold. I then rebooted. At that point the 2018 PGI version came to life, and it read my license file fine and I could compile again. Lord knows what's going to happen when I go to run IDL though...
        • Strongly recommend downloading latest xcode and trying to open it (so that you install the other stuff) before doing much else.
        • For the pgfortran compiler to work, you need to do a sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.o /usr/lib/crt1.o
        • For Yosemite you will also need a
          • sudo ln -s /opt/X11 /usr/X11R6
          • sudo ln -s /opt/X11 /usr/X11
        • For El Capitan/Sierra, one needs to find an older version of stdint.h and put it in /usr/include. Here is a copy This is needed for compiling pgplot.
      • In the .tcshrc put
        • setenv PGI /opt/pgi
        • setenv LM_LICENSE_FILE $PGI/license.dat
        • source /Volumes/strax/cmfgen/cur_cmf/com/aliases_for_cmfgen.sh
        • set path = ($PGI/osx8-64/15.3/bin/ $path)
        • setenv PGPLOT_DEV /xserve
        • setenv PGPLOT_DIR /Volumes/strax/pgplotorig/pgplot/pgplot (pretty sure this line does NOTHING)
        • setenv PGPLOT_FONT /Volumes/strax/pgplotorig/pgplot/pgplot/grfont.dat
        • setenv NCPUS 4
        • limit stacksize unlimited
    2. One needs the "special" Mac version of pgplot. Here it is. cd to pgplot/pgplot (not pgplotsrc!), "fix" the directory names at the top in Makefile, and then do a "make clean" and a "make all". It will bomb with an error message when it tries to create the cpgdemo stuff (Undefined symbols in MAIN) but you will find to your surprise that libpgplot.a has been created! Joy!
    3. Download the CMFGEN source files from the above link. Create a subdirectory cur_cmf_date and stick the stuff there. Create a symbolic link ln -s cur_cmf_date cur_cmf.
    4. Download the latest and great atomic data as well from the above link.
    5. Edit cmfgen/cur_cmf/Makefile_definitions so it looks something like this.
    6. If you update the version of the compiler, make sure you change the library location in the Makefile_definitions.
    7. NO LONGER NEEDED: Modify the Makefile definitions in "subs" and "plane" to invoke FZ rather than whatever flag it users. This gets around a bug with 14.10 that affects subs/fg_j_cmf_v9.f and plane/fg_j_cmf_v12.f.
    8. edit cur_cmf/com/aliases_for_cmfgen.sh to contain the right paths
    9. make clean
    10. make all
    11. So, you think you're all set, don't you? Well, you're not. You're going to have so start some damn server: /Volumes/strax/PGPLOTOrig/pgplot11.0/pgplot/pgxwin_server &
    12. While how to use CMFGEN is way beyond the scope of this little note, Kathryn's CMFGENGuide is invaluable.

     

    Michael's photometry routines (Thanks to NickM)