*Old* notes, macOS 12 (Intel chip, precompiled binaries)

What to do?

These setup instructions are for macOS 12 with Intel CPUs (not Apple Silicon).

  1. Each step involves either copy+pasting text into a terminal, which is in a green field like:

    ls
    

    ... or a rebooting/clicking on link.

  2. The user must have admin privileges (able to run sudo ls, for example). These steps have “(admin)” in their title. Do not include sudo in a command unless it is already written.

  3. If you need to know your shell type, copy+paste echo $0.

  4. This has been tested on macOS 12.3.1 and 12.4. It may work on macOS 11, but the python installation may not be necessary.

Install Homebrew and packages (admin)

Do not use sudo explicitly with any of these commands. However, some will prompt you for your admin password).

  1. Homebrew:

    cd
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Privacy Setting (opt):

    brew analytics off
    
  3. Packages:

    brew install python netpbm cmake
    
  4. XQuartz:

    brew install --cask xquartz
    
  5. Reboot/restart your computer (for changes to take effect).


Note

XQuartz Suggestion

After you restart, open XQuartz and change a preference. Go to the XQuartz menu near the upper left corner of the desktop. Then go to Preferences… -> Windows -> “Click-through Inactive Windows”. Also “Focus On New Windows” may be useful.

Purpose: Homebrew will install the Xcode command line tools first. macOS 12.3.1 removed python, so we are installing it here. netpbm is needed for some image outputs. cmake is needed for compiling some R libraries. Xquartz is the main desktop manager for X11 programs like afni.

Install R (admin)

  1. Get R v3.6.3 gfortran v6.1:

    cd
    curl -s -L -o R-3.6.3.nn.pkg "https://cran-archive.r-project.org/bin/macosx/el-capitan/base/R-3.6.3.nn.pkg"
    curl -s -L -o gfortran-6.1.pkg "https://cloud.r-project.org/bin/macosx/tools/gfortran-6.1.pkg"
    
  2. Install R:

    sudo installer -pkg R-3.6.3.nn.pkg -target /
    
  3. Install gfortran:

    sudo installer -pkg gfortran-6.1.pkg -target /
    
  4. Cleanup:

    \rm gfortran-6.1.pkg
    \rm R-3.6.3.nn.pkg
    

Purpose: This downloads the installer packages and runs the install from the command line (then removes the downloaded installers). This slightly older R version is needed (at present) to match the AFNI build. gfortran is is used to compile some R libraries.

Update Path

  1. Add to path (zsh):

    touch ~/.zshrc
    echo 'export PATH=$PATH:/usr/local/opt/python/libexec/bin'         >> ~/.zshrc
    echo 'export PATH=$PATH:/Library/Frameworks/R.framework/Resources' >> ~/.zshrc
    echo 'export PATH=$PATH:/usr/local/gfortran/bin'                   >> ~/.zshrc
    source ~/.zshrc
    

Purpose: This adds python, R and gfortran to your path so the command line can use them. Assumes zsh is your login shell (the Mac default).

R Libraries

  1. Install main R libraries:

    Rscript -e "install.packages(c('afex','phia','snow','nlme','lmerTest'), repos='https://cloud.r-project.org')"
    

Purpose: Installs the R libraries needed for primary AFNI stats (R-based) programs. Note that some newer Bayesian stats programs require other libraries. Some libraries other libraries are not available on macOS for R 3.6.3. (We are working on updating this) afni_system_check.py -check_all will show some missing libraries.

Install AFNI

  1. Get+unpack AFNI binaries:

    curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
    tcsh @update.afni.binaries -package macos_10.12_local -do_extras
    
  2. Open a new terminal (or source current shell’s “rc” file, as suggested in finishing text).

Purpose: Install AFNI binaries (in default ~/abin location).

Note

Upon first afni or suma launch, the terminal will pop up messages to ask for permissions to access various data on your system, such as: Photos, Desktop, Contacts, Calendar, Reminders, Documents, Downloads. I would recommend not allowing Photos, Contacts, Calendars, and Reminders. But the others will be useful.

Note

And if you launch afni from your home folder, you will get a lot of “Operation not permitted” errors/warnings from afni trying to find datasets in restricted folders under your home directory, like ~/Library etc. You can safely ignore those errors.

Evaluate setup/system (important!)

  1. Open a new terminal, and then 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:

    afni
    suma
    

Report any crashes or problems!

If stuck, then …

  • try searching online with the error message, and/or ask on the Message Board

  • send the system check to an AFNI guru for advice—copy+paste:

    afni_system_check.py -check_all > out.ASC.txt
    

    ... and email the file “out.ASC.txt”.

Optional Extras

Setup Python (a method)

AFNI has very minimal Python requirements—at present, matplotlib and numpy. For example, for the recommended automatic QC output from afni_proc.py, matplotlib is necessary.

You can use any method to install+manage Python and its dependencies. In fact, your OS might have all the Python+modules needed to run AFNI already. Check this by running:

afni_system_check.py -check_all

... and seeing there are no notes in the “Please fix” section at the end—if there are none about Python, then you are all set!

But if you do still need to setup Python with appropriate modules, or you want to manage different environments with different package needs (Python or otherwise), then we note that we have found Miniconda to be convenient. It is cross-platform (with occasional OS-specific quirks). If you are interested in either using it or reading more about it, you can check out this tutorial, which has both verbose and quick instructions.

But Miniconda is not required.

Prepare for Bootcamp (install demo data)

  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!

Setup terminal (opt)

  1. Copy+paste:

    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” for relevant applications. After this, clicks on a new window are directly applied, without needing to “pre-click” it. You’re welcome.

Niceify terminal (add convenience!)

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
echo 'alias ls="ls -G"'     >> ~/.zshrc
echo 'alias ll="ls -lG"'    >> ~/.zshrc
echo 'alias ltr="ls -lGtr"' >> ~/.zshrc

Purpose: The first command block sets up tab autocompletion for tcsh (which should already be enabled for bash users by default). The second set of commands make aliases for the main shells 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!

Note

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.