- Installation
- Memory
- Using 64-bit Java on Leopard
- Upgrading
- Drag and Drop
- Known Problems
- Troubleshooting
![]()
- Adding JAR Files
- Switching Java Versions
- Running from the Command Line
- About the Icon
Installation
Download ImageJ for Mac OS X from the Download page and double-click on "ImageJxxx.tar.gz" to extract the ImageJ folder. Copy this folder to the Applications folder, open it, and copy either ImageJ or ImageJ64 to the dock. ImageJ runs in 32-bit mode using Java 1.5 (Java 1.4 on OS X 10.3) and ImageJ64 runs in 64-bit mode using Java 1.6. ImageJ64 is not limited to 1800MB of memory but it requires a 64-bit Intel Mac running Mac OS X 10.5 or later. The "ImageJxxx.tar.gz" file can be deleted.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.
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.<key>VMOptions</key> <string>-Xms64m -Xmx1000m</string>Using 64-bit Java on Leopard
On Macs with 64-bit Intel processors, Java 1.5 or later and OS X 10.5 or later, 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 the title of the Edit>Options>Memory & Threads dialog box changes to "Memory (64-bit)" when ImageJ is running in 64-bit mode.
![]()
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
Use the Help>Update ImageJ command to upgrade to the latest version of ImageJ.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
- With Java 1.6, the first drag and drop on the ImageJ window is sometimes ignored. This bug can be worked around by dropping on the toolbar instead of the status bar.
- 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.
- The optional "Tap to Click" feature on MacBooks and MacBook Pros does not reliably enable/disable checkboxes in ImageJ dialog boxes.
- 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.
- Shift-clicking to select multiple ROIs in the ROI Manager does not work with Java 1.6. This bug has been reported to Apple (ID# 7092724).
- 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.
- On Leopard, running Java 1.5.0, the File>New>System Clipboard command generates an exception. This bug is reported to be fixed in the Java for Mac OS X 10.5 Update 2.
- 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.
- 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).
- 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!
- 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.
- Image drawing is very slow. The Plasma plugin and Plasma2 applet are test cases for this problem.
- 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.
- 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.
Troubleshooting
Here are three common problems encountered when running ImageJ on Mac OS X, and their solutions:
- I upgraded Java and ImageJ64 stopped working.
Upgrade to the ImageJ64 included with ImageJ 1.42.
- Commands that use QuickTime do not work.
Use ImageJ instead of ImageJ64. QuickTime for Java does not work in 64-bit mode.
- The Help>Update ImageJ command is missing or does not work.
Use the ImageJ Updater plugin, which is included with ImageJ 1.42.
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:
- Launch Java Preferences.
- In the Applications area, drag "J2SE 6.0 (64-bit)", "J2SE 5.0" or "J2SE 1.4.2" to the top position.
- 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:The -Xmx256m switch specifies that ImageJ will have available a maximum of 256MB of RAM.java -jar -mx256m ij.jar (or java -mx256m -cp ij.jar ij.ImageJ)Here is a simple AppleScript that sends commands to Terminal to have it automatically launch ImageJ:
Or use AppleScript's "do shell" command:tell application "Terminal" run do script with command "cd /Applications/ImageJ java -jar -mx350m ij.jar" end tellThese 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.do shell script "cd /Applications/ImageJ;java -jar -mx350m ij.jar"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.