Monday, January 18, 2016

AFNI Install on OS X El Capitan

It's been two and half years (three, if you round up) since I uploaded the first videos about AFNI: How to install it, how to run it, how to make it fulfill all your wildest dreams, which may or may not include taking a dollop of Nutella, drying it in the sun, grinding it into a fine powder, and then snorting it.

I was in Rochester for three weeks in July, lodged at a fly-blown hostel. During the days I would talk with researchers and go to meetings and help design studies, but found myself more often on the benches of Eastman Quadrangle, lazily swatting at mosquitoes and feeling the burst of their rubescent abdomens against my skin. I would sit outside where in the distance you could see a church with large oval stained glass and I would think about nothing in particular. The weather in the mornings was perfect, and I took my exercise down by the Erie canal, up around Cobbs Hill Reservoir, and through neighborhoods I didn't know. In the evenings I would make my way downtown for music at the Eastman School and barbecue on the Genesee. And in those nights I worked, obsessively, on those tutorials and videos whose fate had somehow become strangely entangled with mine. Who knew who was reading, who was watching? There was something of an inverted voyeuristic pleasure in thinking about it.

And now here I am, three years later, promoted to seedy manhood and reminiscing of towns and cities; those icy runs on the country lanes of Northfield in windchills of forty below; going to the piano rooms of the Wexner center to practice Scriabin etudes and my beloved, immortal Waldstein; running around Woodlawn field, each loop zero point four-two miles, running ten, twenty, thirty loops at a time, hoping that enough physical exertion would work off a serious infection of heartsickness; crossing the finish line in Indianapolis with burning lungs and knotted calves, surrounded by the vomit of fellow runners, the clock just a shade under two hours and thirty minutes, feeling something break inside me and knowing it was the end of something.

Such were the days, comrades - and how the days have changed! All that I did back then was well enough for its time; but as new wine requires new bottles, so do new operating systems require new installation instructions; and it has come to my attention that several AFNI users are having issues, both technically and emotionally, with getting AFNI to cooperate with Macintosh's newest OS, El Capitan (which is Spanish for, "The Capitan.")

Sensing that urgent action was needed, I turned on my computer, booted up my web browser, and sat with my posterior firmly planted on my chair until somebody else fixed the problem. Fortunately this was not long in coming, and Pete Molfese over at Crash Log has documented how to do it; however, as I am sensitive to how long it takes to click on links, I have reproduced all of the instructions here in full, along with a helpful video which maybe includes a special effect involving my sports jacket.

Here are the steps:

  1. Install XQuartz from xquartz.org (Allows GUIs to run from Unix shells; the "X" symbol that pops up in your dock when you first run AFNI)
  2. Install XCode from the Apple Store
  3. Install Homebrew (a package manager for Mac) using the following command:
    1. For bash: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    2. For tcsh: curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install | ruby
  4. Use homebrew to get the following:
    1. The GNU Compiler Collection (GCC) with: brew install gcc --with-all-languages --without-multilib
    2. Pyqt, which you'll need for the .py scripts in AFNI: brew install pyqt
    3. GLib, low-level libraries that take care of the little things under the hood: brew install glib
  5. Link libgomp to the correct location using the following:
    1. ln -s /usr/local/Cellar/gcc/5.3.0/lib/gcc/5/libgomp.1.dylib /usr/local/lib/libgomp
    2. Note that the version is continually being updated, so this command may change; for example, replace the 5.2.0 part with 5.3.0. Check the path to /usr/local/Cellar/gcc to see if the path exists. If you link the wrong path, rerun the command with the correct path and the -sf option.
  6. Download the latest AFNI package here, or type the following into your terminal (assuming you are installing version 10.7; replace with whatever version you want to download):  
cd
mkdir abin
curl -O http://afni.nimh.nih.gov/pub/dist/tgz/macosx_10.7_Intel_64.tgz
 tar -xzf macosx_10.7_Intel_64.tgz 
mv macosx_10.7_Intel_64 abin
rm macosx_10.7_Intel_64.tgz
  1. Paste the following commands from the AFNI install webpage into your terminal (for tcsh shell):
echo 'set path = (/usr/local/bin $path $HOME/abin)' >> .cshrc
echo 'setenv DYLD_FALLBACK_LIBRARY_PATH $HOME/abin' >> .cshrc

echo 'setenv PYTHONPATH /usr/local/lib/python2.y/site-packages' >> .cshrc
source .cshrc
rehash





19 comments:

  1. Interestingly, this post contains everything to install AFNI except AFNI itself :)

    ReplyDelete
    Replies
    1. That is interesting, isn't it? It's also embarrassing.

      The post has been updated and more steps have been added. The video, however, remains unchanged (I had to do too many takes for that sports jacket thing, and I'll be damned if I have to do it again).

      -Andy

      Delete
  2. This is one of your more beautiful posts, Andy. :)

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Hi Gunnar,

      I would try source .cshrc in your home folder, or just type "rehash." If that doesn't work, check to make sure that the path from your source file is pointing to the right installation directory for AFNI.


      Best,

      -Andy

      Delete
  4. how about running AFNI in windows

    ReplyDelete
    Replies
    1. For that you would probably need a virtual machine, but I don't have much experience with those. Good luck!

      -Andy

      Delete
  5. Hello Andy,

    I can't seem to get the paths set correctly.

    For this line: set path = (/usr/local/bin $path $HOME/abin)

    looking at the real directory $HOME/abin/macosx_10.7_Intel_64

    should all the contents of macosx_10.7_Intel_64 live inside abin or should I just correct the line to include the macosx... directory


    For line: setenv PYTHONPATH /usr/local/lib/python2.y/site-packages

    looking in directories: /usr/local/lib

    python2.y directory does not exist...


    Any thoughts much appreciated

    Thanks so much

    joseph


    ReplyDelete
    Replies
    1. Hey Joseph,

      You could change the line to point to the macosx directory, or you could move everything from the macosx directory to the abin directory. Either way should work.

      As for the Python path, doublecheck what version of python you have; python2.y seems off to me; it should be something more like python2.7 or python2.6.


      Best,

      -Andy

      Delete
    2. I had not installed python yet

      So I ran brew install python

      and got python2.7

      which now can be sourced.

      Thanks a bunch buddy

      Thanks so much for this entire page!! and your videos
      Very Very Very much appreciated!

      Delete
  6. Hi Andrew,

    Everything works until the echo commands, no errors are shown but i when i type in afni it does not pop up. also when i type in 'ls abin' macosx_10.7_intel_64 pops up, not the afni details like it did in your other video.

    could you please help me :(

    ReplyDelete
    Replies
    1. Hey there,

      Try moving everything in the macosx folder into the abin directory, e.g.:

      mv macosx_10.7_intel_64/* ~/abin

      -Andy

      Delete
  7. I am getting some errors during installation.
    This is my exit output when running afni_system_check.py.

    I cannot get libgomp resolved.

    How can I send my output file as I cannot attached here as txt.

    ReplyDelete
    Replies
    1. Hi Gamal,

      I would post that to the AFNI message board; they would have more insight into it than I would.


      Best,

      -Andy

      Delete
  8. Hi Andy,

    I recently upgraded to El Capitan and reinstalled AFNI (deleted the older version) following the steps you outlined. BUT every time I want to start AFNI I need to set all the paths again. Any idea why that might be happening? Could it be that I need to remove the paths that were set in .cshrc file when I had installed AFNI with my older version of OSX

    ReplyDelete
    Replies
    1. Hi Nena, yes, I would go ahead and reset your paths; make sure that the path points to where the new AFNI binaries are.

      -Andy

      Delete
  9. Hi Andy,

    thanks again for your amazing blog. It is very helpful!!
    So, do you know something about the installation of AFNI in Mac OS sierra?
    I am having problems with this command: brew install gcc --with-all-languages --without-multilib
    There are error messages for--with-all-languages and --without-multilib.
    Could you help me?

    Thanks again!!

    ReplyDelete
    Replies
    1. Hey Gabriela, I haven't used Sierra yet, so I can't say what the problem is. I would try posting that to the AFNI message boards and see what they have to say; they've probably debugged it.

      -Andy

      Delete