Mac OS, 10.9-15 (via command line)¶
What to do?¶
These setup instructions are for Mac OS versions 10.9-15.
Note
If you are seeking the new App version of install instructions, *and have a Mac OS version 10.13-15, please click HERE.
Each step involves either copy+pasting a command or clicking on a download link.
Copy and paste: In most terminals, use
Ctrl+Shift+candCtrl+Shift+v. (In WSL terminals, one might first enable this functionality: rightclick on the panel’s taskbar, select “Properties” and put a checkmark by this option.)Admin privileges: can you run
sudo lsand enter the correct password? If you can’t, ask an administrator to do the steps that start with sudo, and you can do the rest.Terminal type: To see your terminal shell type (
bash,zsh,tcsh, etc.), run this command:echo $0
Installation check: Run the system check in the “Evaluate” stage. Try any recommendations in its “Please Fix” section.
Getting help: if you run into any problems, please just ask a clear question on the AFNI Message Board.
To open a text file, use any text editor you like, and/or you can type
gedit FILENAME, such as either:gedit ~/.bashrc gedit ~/.bashrc &
To open a text file, you can type
open -t FILENAME. For example, to open the bash “rc” file:open -t ~/.bashrc
Setup terminal¶
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.
Install Xcode and XQuartz¶
Copy+paste:
xcode-select --install
For …
- … OS X >= 10.11, click on this link:Then click on the “Quick Download” DMG, and follow the instructions to install.
… OS X 10.9 and 10.10, copy+paste:
/Applications/Utilities/X11.app
Purpose: These install Xcode command line tools (needed for the gcc compiler et al.) and XQuartz (the desktop manager needed to run X11 programs, such as
afni!).
Setup Mac env 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' >> ~/.bashrcPurpose: This adjusts the library format variable for XQuartz in both
tcshandbash. Sigh.
Install AFNI binaries¶
For …:
… (default) installing the binaries from online, copy+paste:
cd 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
… (alternative) installing already-downloaded binaries, you can use
-local_package ..(replace “PATH_TO_FILE” with the actual path; also, if@update.afni.binarieshas also been downloaded, you can skip thecurl ..command), copy+paste:cd curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries tcsh @update.afni.binaries -local_package PATH_TO_FILE/macos_10.12_local.tgz -do_extras
Purpose: Download and unpack the current binaries in your
$HOMEdirectory; set the AFNI binary directory name to$HOME/abin/; and add that location to the$PATHin both~/.cshrcand~/.bashrc. This command also sets up default~/.afnircand~/.sumarcprofiles and environment variables.
Reboot¶
Please logout and log back into your system.
Purpose: This deals with system updates, any change in login shell, and path updates.
Install R¶
- Click on this link:Purpose: Get R-3.6.3 (a recent, but not the most recent, version of R).
Copy+paste:
sudo rPkgsInstall -pkgs ALL
Purpose: Get specific R packages needed for AFNI programs.
Install Netpbm¶
Copy+paste:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Copy+paste:
brew install netpbm
Purpose: Install “netpbm”, which has functionality for converting
image formats (such as to PNG) and is used in several programs like
@snapshot_volreg, @chauffeur_afni and others. Uses the
package manager homebrew to do the installation.
Setup Python (opt)¶
AFNI has a small number Python requirements, like Numpy, Matplotlib, flask and flask_cors.
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 check for any notes in the “Please fix” section at the end. If there are none about Python, then you are all set!
But if you still need to install some Python modules, you might consider using Miniconda. It is a convenient, cross-platform way to setup Python (and other packages) and manage environments. If you want to use it or learn more, check out this tutorial for both quick and detailed instructions. We have tutorial notes here for both installing Miniconda and using it to get the necessary Python libraries for AFNI.
Prepare for Bootcamp¶
The AFNI Bootcamp involves hands-on learning with processing and looking at data. The packages installed here include the data, handouts and useful “cheat sheets” of commands. The full download size is several GB, and you should leave at least 10 GB free on your computer after downloading+unpacking the data, to be able to run various examples.
Copy+paste (to download+unpack Bootcamp data to your home directory; note that this will overwrite any pre-existing Bootcamp directories):
cd install_bootcamp_data.tcsh -do_install yes
If you want to remove the compressed packages that were downloaded, you can also delete theafni_boot_packages/directory.- !Pro tip!: Bring a computer mouse to use at the Bootcamp. It is muuuuch easier to follow the demos that way.
Read+practice the handy Unix documentation/tutorial. This will 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!)¶
Open a new terminal, and copy+paste:
afni_system_check.py -check_all
- Read the “Please Fix” section at the end. If there are no suggestions, then rejoice! Otherwise, try the suggestion(s) there.
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”.
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
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.
Install extras (optional, but recommended for Bootcamp prep)¶
If you plan to use the FATCAT_matplot functionality in AFNI, then copy+paste the following:
@afni_R_package_install -shiny -circos
Purpose: This script will install the R packages for FATCAT_matplot and other ‘shiny’ tools (via bioconductor). And it might take a little while to complete…
Keep up-to-date (remember!)¶
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
apearchhelp information. Update often!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.
Enable more SUMA keypresses (recommended)¶
Symbol |
Abbrev |
Name |
|---|---|---|
|
cmd |
command |
|
opt (or alt) |
option (or alt) |
|
shift |
shift |
|
ctrl |
control |
|
left, up, down, right |
left arrow, up arrow, down arrow, right arrow |
Some of Mac’s default keyboard shortcuts hijack basic SUMA GUI keypresses. You can unset those from the Mac list, and therefore use them in SUMA.
Click your way to “System Preferences” -> “Keyboard” -> “Shortcuts”.
In the “Mission Control” tab, change or deselect:
ctrl+up,ctrl+down,ctrl+left,ctrl+rightF10
Other key combinations to leave free include:
shiftplus any arrowsctrl+shiftplus any arrowsctrl+r,ctrl+s,ctrl+h,ctrl+n




