1.2.2. Mac OS (admin’ed): the regular user part

What to do?

Here we describe the regular users’s part of the AFNI installation and system setup for administered Mac OS versions 10.9+. Root privilege is not required.

These are accompanied by instructions for administrators, which need to be performed first.

Check shell

To find out what shell you are using (e.g., bash or tcsh), type:

echo $0

Most AFNI scripts are written in tcsh, and most command line examples presented also use tcsh syntax. If you would like to change your default shell, please ask your administrator to do so (as it typically requires admin privileges on a Mac to do so).

Setup terminal

Copy+paste the following into a terminal:

defaults write org.macosforge.xquartz.X11 wm_ffm -bool true
defaults write org.x.X11 wm_ffm -bool true
defaults write com.apple.Terminal FocusFollowsMouse -string YES

Purpose: This sets the policy where “focus follows mouse”, so that it is not necessary to first click on a new window (to select it) before subsequent clicks are applied to that window. These commands set the policy for the 3 applications that this might apply to.

Install AFNI binaries

  1. Copy+paste the following:

    curl -O https://afni.nimh.nih.gov/pub/dist/bin/macosx_10.7_local/@update.afni.binaries
  2. Then,

    • For OS X >= 10.12, copy+paste:

      tcsh @update.afni.binaries -defaults -package macos_10.12_local
    • For OS X < 10.12, copy+paste:

      tcsh @update.afni.binaries -defaults -package macosx_10.7_local

Purpose: download and unpack the current binaries into your $HOME directory; set the AFNI binary directory name to $HOME/abin/; and add that location to the $PATH in both ~/.cshrc and ~/.bashrc.


If the AFNI binary package has already been downloaded already (say, to save time/bandwidth), one can use -local_package, followed by the location+name of the binary file, e.g. the third line in the above command could be:

tcsh @update.afni.binaries -local_package macosx_10.7_local.tgz -do_extras

Setup environment variables

Copy+paste the following:

touch ~/.cshrc
echo 'if ( $?DYLD_LIBRARY_PATH ) then' >> ~/.cshrc
echo '  setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:/opt/X11/lib/flat_namespace' >> ~/.cshrc
echo 'else' >> ~/.cshrc
echo '  setenv DYLD_LIBRARY_PATH /opt/X11/lib/flat_namespace' >> ~/.cshrc
echo 'endif' >> ~/.cshrc

touch ~/.bashrc
echo 'export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/X11/lib/flat_namespace' >> ~/.bashrc

Purpose: This adjusts the library format variable for XQuartz in both tcsh and bash. Sigh.


Please logout and log back into your system.

Purpose: This deals with system updates, any change in login shell, and path updates.

Make AFNI/SUMA profiles

  1. Copy+paste:

    cp $HOME/abin/AFNI.afnirc $HOME/.afnirc
    suma -update_env

    Purpose: Set up vanilla-mode environment variables for AFNI and SUMA. To see how you can bend these to your will later, read the Technical notes.

Prepare for Bootcamp

  1. Copy+paste:

    curl -O https://afni.nimh.nih.gov/pub/dist/edu/data/CD.tgz
    tar xvzf CD.tgz
    cd CD
    tcsh s2.cp.files . ~
    cd ..

    Purpose: Download the Bootcamp class data; untar+unzip it (= open it up); move into the newly opened directory; execute a script to copy the files to $HOME/..

    If no errors occur in the above, and your afni_system_check.py says things are OK, you can delete/remove the tarred/zipped package, using “rm CD.tgz”. If you are really confident, you can also deleted the CD/ directory in the present location.

  2. !Pro tip!: Bring a computer mouse to use at the Bootcamp. It is muuuuch easier to follow the demos that way.

  3. Read+practice with the handy Unix documentation/tutorial.

    Purpose: give you a quick lesson/refresher on using basic Linux shell commands (e.g., ls, cd, less, etc.). It will greatly enhance your bootcamp experience– we promise!

Evaluate setup/system (important!)

  1. Copy+paste:

    afni_system_check.py -check_all
  2. Read the “Please Fix” section at the end. If there are no suggestions, then rejoice! Otherwise, try the suggestion(s) there.

  3. Open up the AFNI and SUMA GUIs, juuuust to make sure all is well:


    Report any crashes!

  4. If stuck, then …

    • … put any error message into an online search, and/or post a question on the Message Board

    • … copy+paste this:

      afni_system_check.py -check_all > out.afni_system_check.txt

      ... and email the file “out.afni_system_check.txt” to an AFNI Guru for advice.

Niceify terminal (optional, but goood)

To improve your life when using the terminal, copy+paste these:

echo 'set filec'    >> ~/.cshrc
echo 'set autolist' >> ~/.cshrc
echo 'set nobeep'   >> ~/.cshrc

echo 'alias ls ls -G'    >> ~/.cshrc
echo 'alias ll ls -lG'   >> ~/.cshrc
echo 'alias ltr ls -lGtr'   >> ~/.cshrc
echo 'alias ls="ls -G"'  >> ~/.bashrc
echo 'alias ll="ls -lG"' >> ~/.bashrc
echo 'alias ltr="ls -lGtr"' >> ~/.bashrc

Purpose: The first commands set up tab autocompletion for tcsh (which should already be enabled for bash users by default). The second set of commands make aliases so that different types of files (“normal” files, zipped files, executables, et al.) and directories are shown using different colors and boldness. It makes it much easier to navigate on a terminal, IMHO.

Keep up-to-date (remember!)

  1. To update your AFNI sometime, copy+paste:

    @update.afni.binaries -d

    That’s it!!

    Purpose: This will automatically download the correct, latest AFNI version to your computer, replacing your old binaries. It will also update the apearch help information. Update often!

  2. To check your AFNI version, copy+paste:

    afni -ver

    Purpose: Report this useful info whenever asking a question on the Message Board!


The record of all changes (new options, new programs, bug fixes, et al.) in AFNI programs is maintained for all to see in the online AFNI History.