tags:

views:

2623

answers:

5

How can I open multiple Eclipse workspaces at the same time on the Mac?

On other platforms, I can just launch extra Eclipse instances, but the Mac will not let me open the same application twice. Is there a better way than keeping two copies of Eclipse?

+7  A: 

It's pretty simple.

At the command line, navigate to your Eclipse installation. For example:

cd /Applications/eclipse/

or wherever you installed Eclipse to.

Once there, launch Eclipse as follows:

./eclipse &

This will launch eclipse and immediately background the process.

Rinse and repeat to open as many unique instances of Eclipse as you want. I'm not sure if there is a way to do this from the GUI, but I'm comfortable at the command line so it's a no-brainer for me.

Hope that helps!

Tim Visher
I tried this and it did not work?
Milhous
this works on *nixes.
Seiti
true, but the OP mentions Mac.
Milhous
Adam K. Johnson
+4  A: 

I tried the answer from stopsineman, but to no avail.

cd /Applications/eclipse/

open -n Eclipse.app

This seems to be the supported native method in os X.

Milhous
+5  A: 

Actually a much better (GUI) solution is to copy the Eclipse.app to e.g. Eclipse2.app and you'll have two Eclipse icons in Dock as well as Eclipse2 in Spotlight. Repeat as necessary.

Jevgeni Kabanov
+1  A: 

I found this solution a while back, can't remember where but it still seems to work well for me.

Create a copy of Eclipse.app for each workspace you want to work in (for this example ProjectB.app), then open ProjectB.app/Contents/MacOS/eclipse.ini and add these two lines at the beginning of the file:

-data
/Users/eric/Workspaces/projectb

... substituting where your workspace is located. When you launch ProjectB.app it will automatically start with that workspace instead of prompting for a location, and you should be able to run it at the same time as other Eclipse instances with no problem.

devewm
+3  A: 

If the question is how to easily use Eclipse with multiple different workspaces, then you have to use a kludge because shortcuts in OS X do not provide a mechanism for passing command line arguments, for example the "--data" argument that Eclipse takes to specify the workspace. While there may be different reasons to create a duplicate copy of your Eclipse install, doing it for this purpose is, IMNSHO, lame (now you have to maintain multiple eclipse configurations, plugins, etc?).

In any case, here is a workaround. Create the following script in the (single) Eclipse directory (the directory that contains Eclipse.app), and give it a ".command" suffix (e.g. eclipse-workspace2.command) so that you can create an alias from it:

#!/bin/sh
# open, as suggested by Milhous
open -n $(dirname $0)/Eclipse.app --args -data /path/to/your/other/workspace

Now create an alias to that file on your desktop or wherever you want it. You will probably have to repeat this process for each different workspace, but at least it will use the same Eclipse installation.

aaron