Directions To Install CellProfiler Analyst on Mac

CellProfiler-Analyst requires a 64bit-Java 8 Java Development Kit (JDK), a special version of Java that allows CPA to open microscope images from many different vendors using the BioFormats library. You will need to install this software and configure your computer to run it properly.

Step 0: Check to see if you have 64-bit-Java 8 JDK installed

Open the terminal program on your computer (located in the Utilities folder within your Applications). Then copy and paste the following command and press enter.

 ls /Library/Java/JavaVirtualMachines 

You’re looking for something like jdk1.8.0_192.jdk (the numbers after the underscore may vary) or adoptopenjdk-8.jdk to appear as text in your terminal window. If you do see that, proceed to step 3. If not, proceed to step 1 to install a 64-bit Java8 JDK.

Step 1: Download and install 64 bit-Java8 JDK

Free JDKs can be downloaded from https://adoptopenjdk.net/. Ensure you use OpenJDK8 and the 64 bit version for your OS. We recommend selecting the HotSpot JVM. 

CPA Java Install

Step 2: Find the name of your Java8 JDK

After installing the 64bit-Java8 JDK, return to the terminal program. Then copy and paste the following command. The goal of running this command is to see what your Java8 program is called:

 ls /Library/Java/JavaVirtualMachines 

If you have multiple Java programs installed, copy the name that corresponds to Java8. You’re looking for something like  jdk1.8.0_192.jdk (the numbers after the underscore may vary) or adoptopenjdk-8.jdk. In the following instructions, replace YOUR_JAVA_VERSION with this name.

NOTE: The next steps involve setting the Java environment for your whole machine—something that obviously may have consequences for other programs installed on your computer.  One way you can check if Java environments are already set system-wide on your machine, is to type the following into your terminal:

 echo $JAVA_HOME 

If a result comes back, likely something else is using Java, so you may want to proceed past the semi-permanent option to the “temporary” option. 

Step 3 (semi-permanent): To tell your computer where to find Java8 JDK by setting JAVA_HOME

Here, you’ll configure your terminal to tell your computer where Java is installed. You can do this using the following commands. 

Look at the top of your terminal window. If it says “bash”, then your terminal is a bash terminal. If it says “zsh”, then your terminal is Z shell. 

First, use the nano text editor to open the preferences for your shell. If you have bash, use the command:

 nano ~/.bash_profile 

If you have Z shell, the command is

 nano ~/.zshrc 

Then edit the line below to add the name of  YOUR_JAVA_VERSION  (discovered in Step 2 above) and copy-paste the edited line into the bottom line of your shell preferences:

 export JAVA_HOME="/Library/Java/JavaVirtualMachines/YOUR_JAVA_VERSION/Contents/Home" 

Once you’ve pasted this line into your shell preferences file, press Ctrl+O, then Return, then Ctrl+X. These keystrokes will save your updated shell preferences.

Finally, put your edits into use by typing:

 source ~/.bash_profile 
 source ~/.zshrc 

Step 4: Try to open CellProfiler Analyst

If that works, great!

If not, you may also want to try the following command in your terminal (update the name of your Java version first)

 launchctl setenv JAVA_HOME /Library/Java/JavaVirtualMachines/YOUR_JAVA_VERSION/Contents/Home 

Step 5 (optional): To unset steps 3 and 4:

You don’t need to do this to open CPA, of course, but if after using CPA you find that other things on your computer no longer work as expected, here is how you undo what you’ve done:

  • Type in your terminal: 

 launchctl unsetenv JAVA_HOME 

  • Open your terminal environment with either:

 nano ~/.bash_profile
 nano ~/.zshrc 

  • Delete the line you added in step 3, then save and exit by typing Ctrl+O, then Return, then Ctrl+X
     
  • To apply your changes, run either: 

 source ~/.bash_profile 
 source ~/.zshrc 


ALTERNATELY: To temporarily set JAVA_HOME and run CPA

You will need to do these steps every time you run CPA, if the terminal window in question is closed.

Step 3: Set your JAVA_HOME environment variable temporarily

Edit the line below to add the name of  YOUR_JAVA_VERSION  (discovered in Step 2 above) and execute the edited line in your terminal

 export JAVA_HOME="/Library/Java/JavaVirtualMachines/YOUR_JAVA_VERSION/Contents/Home" 

Step 4: Open CellProfiler Analyst from the terminal

In your terminal, type:

 open -n 

Then type a space, then drag the CPA executable into your terminal window — the location should auto-populate to look something like

 open -n /Applications/CellProfiler-Analyst.app 

 After hitting enter, CPA should open, and should work until you close that terminal window. 

If none of the above work, please reach out to us on forum.image.sc with your questions and we’ll be happy to help.