Xyce on macOS Sierra

Xyce is a great free simulator. I recently tried to fire it up on macOS Sierra and ran into a dependency issue. I want to use the Open MPI version to take advantage of multiple cores. The version of Open MPI installed on my system is at a different path and a different version compared to the one Xyce was compiled with. Fortunately, on macOS there’s an easy work around:

otool -L /usr/local/Xyce-Release-6.5.0-OPENMPI-OPENSOURCE/bin/Xyce
install_name_tool -change \
  /opt/openmpi/x86_64-icc-12.1/1.8.2/lib/libmpi_cxx.1.dylib \
  /usr/local/opt/open-mpi/lib/libmpi_cxx.dylib \
  /usr/local/Xyce-Release-6.5.0-OPENMPI-OPENSOURCE/bin/Xyce
install_name_tool -change \
  /opt/openmpi/x86_64-icc-12.1/1.8.2/lib/libmpi.1.dylib \
  /usr/local/opt/open-mpi/lib/libmpi.dylib \
  /usr/local/Xyce-Release-6.5.0-OPENMPI-OPENSOURCE/bin/Xyce

It seems to run fine now.

A better Bash command-prompt

Bash sets the command prompt using the variable PS1, which is evaluated every time the prompt is printed. The following script, stolen from various parts of the internet (sorry, I didn’t keep references), is quite handy. It lists the username, host, working directory, and git/svn branch.

#!/usr/bin/bash
if [[ $- == *i* ]] ; then
    function parse_git_branch () {
        git name-rev HEAD 2>/dev/null | sed 's#HEAD\ \(.*\)#git:\1#'
    }
    function parse_svn_branch() {
        local rurl=`svn info --show-item relative-url 2>/dev/null`
        [[ -n "$rurl" ]] && echo "svn:${rurl}@`svn info --show-item revision`"
    }

    function proml() {
        local BOLD="\[$(tput bold)\]"
        local RED="\[$(tput setaf 1)\]"
        local GREEN="\[$(tput setaf 2)\]"
        local YELLOW="\[$(tput setaf 3)\]"
        local BLUE="\[$(tput setaf 4)\]"
        local PURPLE="\[$(tput setaf 5)\]"
        local CYAN="\[$(tput setaf 6)\]"
        local WHITE="\[$(tput setaf 7)\]"
        local GRAY="\[$(tput setaf 8)\]"
        local DEFAULT="\[$(tput sgr0)\]"

        PS1="${PURPLE}\u${GREEN}@\h ${YELLOW}\w${CYAN} "
        PS1+="\`parse_git_branch\`\`parse_svn_branch\`${DEFAULT}\n> "
    }
    proml
fi