MRI on Mac
In theory, setting up an AFNI workstation should be as simple as this:
- Get a Mac.
- Install the following from the install DVD that came with your Mac:
- XCode Tools
- X11
- X11SDK
- Download and install the MacPorts base system.
- Open a terminal window to get to the Unix command line. (I recommend Utilities/Terminal.)
- Make sure you have the latest MacPorts:
sudo nice port selfupdate- Install afni:
sudo nice port install afniFrom here on, you can use the same "port install" command to install any of the thousands of programs in the MacPorts collection, including many MRI research tools.
Whether or not you use a ports system to install AFNI and other MRI programs, you will need superuser (a.k.a. root) access on the machine. The sudo command provides this in a safer manner than logging in as root or using the "su" command. Consult your system's documentation, or one of the many tutorials available on the WEB for more information on sudo.
The process of committing ports to the MacPorts repository can often take weeks, during which time new features may become available in the software. If you want the latest ports, which are not yet committed to the MacPorts repository, you can get add them to your ports tree (after installing the MacPorts base) using the update_mri_ports script. The newer version installed by this script will have a -latest suffix to distinguish is from the committed version.
Ports still under development will have a -devel suffix. These ports could be in any state from not working at all, to ready for commitment. Use -devel ports only if you're willing to help with testing.
- sudo update_mri_ports
- sudo nice port install afni-latest
Running MRI programs
Many MRI research tools require X11, which does not run by default on the Mac. You must start X11 (which resides in /Applications/Utilities by default) before running these programs.Why the "sudo nice" stuff?
The basic command is really just this:
port install afniHowever, this command requires root privileges, and will hog CPU and memory resources as it builds the port.
The "sudo" command runs the subsequent command as super-user (account name "root"), which is necessary for port installations. If you were to log in as root, or switch to a root session using "su", sudo would be unnecessary. However, root sessions pose a high security risk, since they have the ability to alter any file on the computer, including critical system files. On Mac OS X, even administrator accounts don't have this privilege, so they're much safer to use than the root account. By using sudo, you can run individual commands as root, while logged in as a limited user.
The "nice" command runs the subsequent command at a lowered priority, so that you can continue working on the system without being heavily impacted by competition for the CPU. While not strictly necessary, it's a good idea to use it for any processes that will run while you want to work with other programs.
Substituting or adding other MRI software should simply require changing the port name in the port install command. Of course, there are snags you may run into. Read on for more details about what they are and how to resolve them.
The MacPorts system handles all the details of configuration and installation for you. If any prerequisite libraries, programs, or subsystems are missing, the ports system will download and install them automatically. All you need to worry about is setting up your work environment the way you want it, and of course, learning to use the software (this, I can't help you with).
Installing any committed port should be as easy as typing "sudo nice port install (portname)", and waiting for the build to finish. For non-committed ports downloaded from this site, simply cd into the port directory (the directory containing the "Portfile"), and run
sudo nice port install <portname>Before proceeding, you may want to update your ports system and tree using "sudo nice port selfupdate" and "sudo nice port sync". Note, however, that if you have older ports installed, it's a good idea to update them after using "sudo nice port sync" before attempting to install new ports.
If it takes any more effort than this, please let me know!
![]()