Last active
July 1, 2017 12:12
-
-
Save stefco/5956a92cfb4394255c637471334a7984 to your computer and use it in GitHub Desktop.
This installs everything you need to work with LIGO on a Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ligo stuff taken from https://wiki.ligo.org/DASWG/MacPorts and other sources | |
# run this as an admin but not as root. | |
# Use shellcheck for linting: http://www.shellcheck.net/# | |
set -o errexit | |
set -o nounset | |
set -o noclobber | |
cat <<NOTES | |
# NOTE 0: you need to install macports for this to work: | |
# https://www.macports.org/install.php | |
# NOTE 1: Make sure that /opt/local/bin/env comes first on your path so that you | |
# don't run the anaconda or homebrew versions of programs. | |
# NOTE 2: Make sure to install Ligo Data Grid tools, available here: | |
# https://www.lsc-group.phys.uwm.edu/lscdatagrid/doc/installclient-mac.html | |
# NOTE 3: Homebrew does not work well with MacPorts. Same for other programs | |
# that install to /usr/local. This script will move things out of the way | |
# if necessary and put them back in place after it is finished or if it errors | |
# and exits. | |
# NOTE 4: If you don't want to keep entering your password for sudo, you can | |
# temporarily remove the password timeout for sudo by running visudo and | |
# adding this line: | |
# Defaults timestamp_timeout=-1 | |
NOTES | |
# install xcode command line tools | |
xcode-select --install || echo 'xcode command line tools already installed.' | |
# check whether /usr/local exists. if so, move it out of the way; installing | |
# programs to /usr/local is unsupported by macports, and it will likely cause | |
# errors. in case the script exits prematurely, move everything back into | |
# place. | |
if [ -e /usr/localmoved ]; then | |
echo "ERROR: It looks like a previous installation attempt has been made." | |
echo " This script moves /usr/local to /usr/localmoved in order to" | |
echo " avoid conflicts with MacPorts. Check whether /usr/local exists." | |
echo " If it does exist, you will need to merge your executables from" | |
echo " /usr/localmoved into it. If it does not exist, simply run:" | |
echo "" | |
echo " sudo mv /usr/localmoved /usr/local" | |
echo "" | |
exit 1 | |
fi | |
# move /usr/local out of the way if necessary; | |
# define a cleanup script for putting everything back. | |
function clean_up { | |
if ! [ -e /usr/local ] && [ -e /usr/localmoved ]; then | |
sudo mv /usr/localmoved /usr/local | |
echo 'Moved /usr/localmoved back to /usr/local' | |
elif [ -e /usr/local ] && [ -e /usr/localmoved ]; then | |
echo 'ERROR: both /usr/local and /usr/localmoved exist.' | |
echo 'You will have to figure out how to merge them yourself.' | |
fi | |
} | |
trap clean_up INT TERM EXIT | |
if [ -e /usr/local ]; then | |
echo "WARNING: /usr/local exists. Moving to /usr/localmoved" | |
sudo mv /usr/local /usr/localmoved | |
fi | |
# update macports | |
sudo port selfupdate | |
sudo port upgrade outdated | |
# upgrade ur default bash 2 the newest 1 | |
sudo port install bash | |
sudo bash -c "echo /opt/local/bin/bash >>/etc/shells" | |
chsh -s /opt/local/bin/bash | |
# install ligo stuff | |
sudo port install lscsoft-deps | |
sudo port select --set python python27 | |
sudo port install ligo-gracedb | |
sudo port install nds2-client +swig_java +swig_python | |
sudo port install glue | |
sudo port install lalapps | |
sudo port install pylal | |
sudo port install py27-ipython -scientific | |
sudo port select --set ipython ipython27 | |
# install gwpy and dependencies | |
sudo port install py27-ipython py27-numpy py27-scipy py27-matplotlib +latex +dvipng texlive-latex-extra py27-astropy glue kerberos5 py27-pykerberos nds2-client | |
# install pip | |
sudo port install py27-pip | |
sudo port select --set pip pip27 | |
# install gwpy | |
sudo pip install gwpy | |
# install remote medm viewers | |
sudo bash -c "echo 'rsync://software.ligo.org/macports-testing' >>/opt/local/etc/macports/sources.conf" | |
sudo port selfupdate | |
sudo port upgrade outdated | |
sudo port install xorg-libXt +flat_namespace | |
sudo port install ligo-remote-access | |
clean_up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment