OS X Installation

Installation

Download ImageJ for Mac OS X from the Downloads page and double-click on the file (ijxxx.tar.gz) to extract the "ImageJ" folder. Copy the ImageJ folder to the Applications folder, open it, copy the ImageJ icon (a microscope) to the dock, then run ImageJ by clicking on this icon in the dock.

Memory

Use the Edit>Options>Memory & Threads command to make more than default 192MB 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.8 GB. Another way to make more memory available to ImageJ is by running from the command line and using the -Xmx option. Note that ImageJ is limited to 64MB when you run it by double clicking on ij.jar.

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

    <key>VMOptions</key>
    <string>-Xms64m -Xmx1000m</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. You will also get an error message if the ImageJ application has been renamed.

Using 64-bit Java on Leopard

On Macs with 64-bit Intel processors, Java 1.5 or later, OS X 10.5 and at least 2.5 GB of memory, you can use ImageJ64, which does not have the 1.8 GB limit. ImageJ64 is included with the ImageJ 1.39 and later distribution available on the Download page. Note that ImageJ64 may not be needed when running Java 1.6, which only runs in 64-bit mode.

The title of the Edit>Options>Memory & Threads dialog box changes to "Memory (64-bit)" when ImageJ is running in 64-bit mode.
Dialog
Known problems with 64-bit Java on OS X: 1) Files and directories may not initially appear in file open dialog boxes; 2) File>New>System Clipboard does not work (this is fixed in Java 1.6); 3) Commands that use QuickTime for Java (e.g., FIle>Save As>QuickTime Movie) my fail.

Upgrading

To upgrade to the latest version of ImageJ, replace the ij.jar file in the ImageJ folder with a newer one from http://rsb.info.nih.gov/ij/upgrade/. With ImageJ 1.34 and earlier, control-click on the ImageJ application, select "Show Package Contents", then drag the newer ij.jar into the Contents/Resources/Java folder. You can also update ImageJ using an Applescript application written by Gilles Carpentier.

Drag and Drop

The OS X version of ImageJ opens images, text files, ROIs and LUTs that are dropped on the ImageJ icon.

Known Problems

  1. Keyboard shortcuts sometimes require holding down the command key with Java 1.5 and Java 1.6. To reproduce this problem, press shift-b to open the "blobs" sample image, create a selection, press "w" to close the image, then try to open "blobs" again by pressing shift-b.
  2. Shift-clicking to select multiple ROIs in the ROI Manager does not work with Java 1.6.
  3. Commands and plugins that use QuickTime for Java fail with 64-bit versions of Java and Java 1.6 on Mac OS X is 64-bit only.
  4. On Leopard, running Java 1.5.0, the File>New>System Clipboard command generates an exception.
  5. On Leopard, pressing return to dismiss a dialog sometimes results in the default text field values being used instead of the entered values. ImageJ 1.40e and later have a work around for this bug.
  6. ImageJ sometimes crashes on OS X. Upgrading to the latest version of Java should reduce the number of crashes. This bug has been reported to Apple (ID# 3488737).
  7. OS X requires a lot of memory for each open window. Converting a 1024x1024x10x8-bit stack (10MB) to separate images requires 58MB of additional memory!
  8. There does not appear to be a way to unselect an ROI in the ROI Manager (java.awt.List bug). As a workaround, press the "Unselect" button.
  9. Image drawing is very slow. The Plasma plugin and Plasma2 applet are test cases for this problem.
  10. The available memory value displayed by ImageJ (1.32h or later) is 64MB too high when ImageJ is started by double-clicking on ij.jar or run from the command line due to a bug in Java's Runtime.maxMemory() method.
  11. With Java 1.4.2, the cursor is always an arrowhead. This bug has been reported to Apple (ID# 3761991). A test case applet is available.

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 in ImageJ 1.39 and later 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.

Switching Java Versons

On OS X 10.4 and later, the Java Preferences utility in /Applications/Utilities/Java allows you to switch to a different version of Java:
  1. Launch Java Preferences.
  2. In the Applications area, drag "J2SE 6.0 (64-bit)", "J2SE 5.0" or "J2SE 1.4.2" to the top position.
  3. Click the "Save" button.

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 -mx256m ij.jar
(or java -mx256m -cp ij.jar ij.ImageJ)
The -Xmx256m switch specifies that ImageJ will have available a maximum of 256MB of RAM.

Here is a simple AppleScript that sends commands to Terminal to have it automatically launch ImageJ:

tell application "Terminal"
    run
    do script with command "cd /Applications/ImageJ 
        java -jar -mx350m ij.jar"
end tell
Or use AppleScript's "do shell" command:
do shell script "cd /Applications/ImageJ;java -jar -mx350m ij.jar"
These Applescripts assume that ImageJ 1.35 or later is in the Applications folder. For more information, Gilles Carpentier has a web page that explains how to send commands to ImageJ from AppleScript.

With OS X 10.1 or later, you can also run ImageJ by double-clicking on ij.jar.

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. An article
on O'Reilly's macdevcenter.com site explains how to create photorealistic
icons for Mac OS X.