Skip to content

Instantly share code, notes, and snippets.

@stowler
Last active December 17, 2015 01:09
Show Gist options
  • Save stowler/5526655 to your computer and use it in GitHub Desktop.
Save stowler/5526655 to your computer and use it in GitHub Desktop.
work-around for bxh/imagemagick problem on mountain/lion
#!/bin/bash
#
# workAround-installBxhOnMountainLion.sh
# [email protected]
#
# As of May 2013, the shipping version of BXH/XCEDE tools for OS X includes broken imagemagick:
#
# $ bin/fmriqa_generate.pl ~/test.bxh ~/testQA
# Trying int16 data type (instead of input uint16 datatype).
# Checking for overflow...
# dyld: Library not loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib
# Referenced from: /Users/stowler/Downloads/bxh/bin/montage
# Reason: image not found
# dyld: Library not loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib
# Referenced from: /Users/stowler/Downloads/bxh/bin/convert
# Reason: image not found
# ...(snip)...
#
# $ bin/convert ~/Downloads/rose.jpg ~/Downloads/rose.png
# dyld: Library not loaded: /Users/gadde/install/ImageMagick-6.7.1-6/lib/libMagickCore.4.dylib
#
#
# A temporary fix: install local imagemagick and symlink to it.
#
# In four steps:
# Step 1/4: install imagemagick via macports:
sudo port install imagemagick
# Step 2/4: manualy download most recent bxh/xcede release from nitrc: http://www.nitrc.org/projects/bxh_xcede_tools
# ls -l ~/Downloads/bxh_xcede_tools-*.tgz
# Step 3/4: unpack and install bxh/xcede:
#
# ...first declare the bxh version as it appears in the download filename:
bxhVersion=1.10.7
# ...then unpack, install, and substitute for broken imagemagick binaries:
cd ~/Downloads
tar -zxvf bxh_xcede_tools-${bxhVersion}-MacOSX.i686.tgz
sudo mv bxh_xcede_tools-${bxhVersion}-MacOSX.i686 /usr/local/
sudo ln -s /usr/local/bxh_xcede_tools-${bxhVersion}-MacOSX.i686 /usr/local/bxh
sudo mv /usr/local/bxh/bin/convert /usr/local/bxh/bin/orig_convert
sudo mv /usr/local/bxh/bin/montage /usr/local/bxh/bin/orig_montage
sudo ln -s /opt/local/bin/convert /usr/local/bxh/bin/convert
sudo ln -s /opt/local/bin/montage /usr/local/bxh/bin/montage
ls -al /usr/local/bxh/bin/convert
ls -al /usr/local/bxh/bin/montage
# Step 4/4: For system-wide access, configure the environment via /etc/bashrc :
#
# WARNING: note the \${escapedVariables} below, which
# are escaped for heredoc (http://goo.gl/j3HMJ).
# Un-escape them if manually typing into a text editor.
# Otherwise, just paste these lines to your bash prompt
# (up to and including "EOF" line):
editDate=`/bin/date +%Y%m%d`
editTime=$(date +%k%M)
sudo tee -a /etc/bashrc >/dev/null <<EOF
#------------------------------------------
# on ${editDate} at ${editTime}, $USER
# added some BXH/XCEDE environment statements:
BXHDIR=/usr/local/bxh
PATH=\${BXHDIR}/bin:\${PATH}
export BXHDIR PATH
#------------------------------------------
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment