OS X Installation

Installation

Download ImageJ for Mac OS X from the Download page. The ZIP file you download (Image1.xx.zip) should automatically expand to a folder named "ImageJ". Copy this folder to the Applications folder, open it, and copy ImageJ.app to the dock. A 32-bit version of ImageJ (ImageJ32.app), needed for running QuickTime plugins, is also available, but it is unabe to use more than 1800MB of memory.

With OS X 10.7 or later, the first time you run ImageJ, you may get get an "ImageJ can't be opened because it is from an unidentified developer" message, which can usually be bypassed by right clicking on ImageJ.app and selecting "Open" from the drop down menu. if that doesn't work, open the "Security & Privacy" panel in System Preferences and change "Allow apps downloaded from:" to "Anywhere". You can switch back to the original setting once ImageJ is running.

OS X 10.10 (Yosemite) and later do not include key files required for running commands like File>Import>Using QuickTime and File>Save As>QuickTime Movie that use QuickTime for Java. You can work around this problem by copying the files QTJava.zip and libQTJNative.jnilib, available at imagej.nih.gov/ij/download/qt/ into ~/Library/Java/Extensions, where "~" is your home directory. Yosemite hides the Library folder by default, so you will need to open your home folder and check "Show Library Folder" in the View>Show View Options dialog. Before copying the files, you will need to create the ~/Library/Java and ~/Library/Java/Extensions folders.

macOS 10.12 (Sierra) introduces a security feature called Path Randomization that can cause ImageJ to not work as expected. Path randomization is in effect if the “ImageJ home” path shown in the Image>Show Info window starts with “/private” and plugins are not installed in the Plugins menu. You can disable path randomization by moving ImageJ.app out of the ImageJ folder and then copying it back. If the ImageJ folder is in /Applications you will need to hold down the alt key while dragging ImageJ.app out of the ImageJ folder.

Memory

Use the Edit>Options>Memory & Threads command to make more than default 3000MB of memory available to ImageJ. Note that setting the "Maximum Memory" value to more than about 75% of real RAM may result in poor perfomance due to virtual memory "thrashing". The maximum amount of memory that can be allocated on 32-bit systems is about 1.8GB. Another way to make more memory available to ImageJ is by running from the command line and using the -Xmx option.

The Edit>Options>Memory command updates the VMOptions key in the Contents/Info.plist XML file in the ImageJ.app bundle.

    <key>VMOptions</key>
    <string>-Xms256m -Xmx3000m</string>
You will get an error message if you do not have write permission for the ImageJ application. To check and/or change the permissions, open the ImageJ folder, select the ImageJ application, and use the Finder's File>Get Info command.

Upgrading

Use the Help>Update ImageJ command to upgrade to the latest version of ImageJ. This command may fail with a “Release Notes are not in the expected format” error if you are running a version of ImageJ earlier than 1.50i. You can work around this problem by using the ImageJ Updater plugin to upgrade.

Drag and Drop

The OS X version of ImageJ opens images, text files, ROIs and LUTs that are dropped on the ImageJ icon or on the "ImageJ" window. Drag and drop TIFF files on the >> icon in the toolbar to open them as virtual stacks.

Known Problems

  1. The first time you run ImageJ you may get a "ImageJ can't be opened because it is from an unidentified developer" message.
  2. Plugins may not be installed when running macOS 10.12 (Sierra) due to Gateway Path Randomization.
  3. Commands (e.g. File>Import>Video) and plugins that use QuickTime for Java fail with 64-bit versions of Java and with OS X 10.10 (Yosemite) and later .
  4. Using command-v to paste text into the file name field of Save As dialog boxes does not work. This is a bug in the Java FileDialog class that can worked around by right-clicking in the name field and selecting "Paste" from the drop down menu.

Adding JAR Files

Some plugins require a Java code library contained in a JAR file (e.g., Jama.jar). ImageJ's plugin class loader automatically loads code from such libraries as long as the JAR file is in the plugins folder or an immediate subfolder. The Plugins>Compile and Run command also supports JAR file libraries located in the plugins folder or a subfolder. Note that Compile and Run will not recognize the JAR file if the name does not end in ".jar" or if the name contains an underscore.

Running from the Command Line

To run ImageJ from the command line, open a Terminal window, cd to the ImageJ directory, then use the java command to run ImageJ. The easiest way to do this is to drag the ImageJ folder to the Terminal Window, type return, then type:
java -jar -Xmx1024m ImageJ.app/Contents/Resources/Java/ij.jar
or, with the version bundled with Java 8, type:
java -jar -Xmx1024m ImageJ.app/Resources/Java/ij.jar
The -Xmx1024m switch specifies that ImageJ will have available a maximum of 1024MB (1GB) of RAM.

Use a command like this to run ImageJ from any directory:

java -Xmx1024m -jar /Applications/ImageJ/ImageJ.app/Contents/Resources/Java/ij.jar -ijpath /Applications/ImageJ
ImageJ recognizes the following command line options:
  "file-name"
     Opens a file
     Example 1: blobs.tif
     Example 2: /Users/wayne/images/blobs.tif
     Example 3: e81*.tif

  -macro path [arg]
     Runs a macro or script (JavaScript, BeanShell or Python), passing an
     optional string argument, which the macro or script can be retrieve
     using the getArgument() function. The macro or script is assumed to 
     be in the ImageJ/macros folder if 'path' is not a full directory path.
     Example 1: -macro analyze.ijm
     Example 2: -macro script.js /Users/wayne/images/stack1
     Example 2: -macro script.py '1.2 2.4 3.8'

  -batch path [arg]
    Runs a macro or script (JavaScript, BeanShell or Python) in
    batch (no GUI) mode, passing it an optional argument.
    ImageJ exits when the macro finishes.

  -eval "macro code"
     Evaluates macro code
     Example 1: -eval "print('Hello, world');"
     Example 2: -eval "return getVersion();"

  -run command
     Runs an ImageJ menu command
     Example: -run "About ImageJ..."
     
  -ijpath path
     Specifies the path to the directory containing the plugins directory
     Example: -ijpath /Applications/ImageJ

  -port
     Specifies the port ImageJ uses to determine if another instance is running
     Example 1: -port1 (use default port address + 1)
     Example 2: -port2 (use default port address + 2)
     Example 3: -port0 (don't check for another instance)

  -debug
     Runs ImageJ in debug mode

About the Icon

The ImageJ icon for OS X is based on a photograph by Tom Grill of a
Hartnack microscope, circa 1870's, at www.arsmachina.com. A full size PNG version of the icon is available at rsb.info.nih.gov/ij/images/ImageJ.png.