Launch mac eclipse with environment variables set - eclipse

My company provides an eclipse based development environment which needs some environment variables setting up for the underlying toolchain so multiple versions can be installed concurrently and not take over the system.
I want to provide an icon in finder or the dock which sets these then launches eclipse so customers cannot accidentally launch eclipse without the environment being set. This is what I have tried so far:
Setting environment in Info.plist
for eclipse:
This should be a nice way to do it
but I cannot make it add to the
existing path (like export
PATH=/myapp/bin:$PATH).
bash script wrapping eclipse:
I created a bash script called
eclipse.command to set the
environment then launch eclipse.
This opens a terminal window as well
as the eclipse icon and allows
people to "Keep on dock" for the
bare eclipse. I cannot put
eclipse.command on the dock as it is
not an application.
Applescript wrapping eclipse.command:
An Applescript wrapper around
eclipse.command makes it look like
an app and prevents the terminal
window appearing. Unfortunately I
now get a dock icon for the
applescript and one for eclipse so
can still keep the bare eclipse on
the dock.
Any suggestions? Am I going about this in completely the wrong way?

There is an alternate solution which involves replacing the executable that is run by MacOS X when the user launches the Eclipse application with a shell wrapper that sets up the environment.
Create an empty text file called "eclipse.sh" in the Eclipse application bundle directory /Applications/eclipse/Eclipse.app/Contents/MacOS.
Open the eclipse.sh in a text editor an enter the following contents:
#!/bin/sh
export ENV_VAR1=value
export ENV_VAR2=value
logger "`dirname \"$0\"`/eclipse"
exec "`dirname \"$0\"`/eclipse" $#
In the example ENV_VAR1 and ENV_VAR2 are the environment variables being set up. These variables will be visible to processes launched from within Eclipse. The logger command will just log the path of the eclipse executable to the system.log as a debugging aid.
In the Terminal set the executable flag of the shell script eclipse.sh, i.e.:
chmod +x /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.sh
Open the Eclipse.app Info.plist and change the value for the key CFBundleExecutable from eclipse to eclipse.sh.
MacOS X does not automatically detect that the Eclipse.app's Info.plist has changed. Therefore you need to force update the LaunchService database in the Terminal by using the lsregister command:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/eclipse/Eclipse.app
The next time you launch Eclipse.app from the Dock or from the Finder the environment variables should be set.

I created the following:
alias start-eclipse='open /Applications/eclipse/Eclipse.app'
If you run start-eclipse from the command line, all env vars will be picked up. This way, you only need to maintain a single set of env vars across both command-line and eclipse environments.

Take a look at a related question: Environment variables in Mac OS X.
Basically, this involves the creation of a ~/.MacOSX/environment.plist file.
Log out and Log in for the environment.plist to get picked up by .App's

This worked perfectly in OS X Yosemite:
Open /Applications/Automator.
When the drop-down appears asking you what kind of document you want to create, choose "Application."
In the second-from-the-left list, double-click "Run Shell Script."
In the right side delete the "cat" that gets put there automatically, and replace it with this:
source ~/.bash_profile && /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
Now go to File->Save, and save the application to your Applications directory. I named it "Eclipse" with a capital 'E' so as not to conflict with the "eclipse" directory I already had. For good measure, you can even give it the Eclipse icon by selecting the real eclipse app, pressing command-i, selecting the icon, pressing command-c, then selecting the automator "Eclipse" app, pressing command-i, selecting the icon, and pressing command-v.
Now you can open the app, or even drag it to your dock. Note that if you start it, the "real" eclipse will still show up in your dock as a separate icon, but you can't have everything. :)

sakra's answer above is awesome, except is doesn't automatically inherit your existing bash environment. To ensure eclipse.sh picks up your existing bash environment, modify eclipse.sh to use bash instead of sh and add a line to source your existing ~/.bash_profile thus:
#!/bin/bash
source ~/.bash_profile
logger "`dirname \"$0\"`/eclipse"
exec "`dirname \"$0\"`/eclipse" $#

None of the above worked for me. you have to set Eclipse -> Preferences -> Terminal -> Arguments set to --login
That will instruct Eclipse to login with your account just after opening Terminal.
See screenshot:
Reference: https://marketplace.eclipse.org/comment/4259#comment-4259

Link to Eclipse doesn't use the path set in .bashrc
Create simple script
#!/bin/bash
source /home/user/.environment_variables
/home/user/eclipse_cpp/eclipse -Duser.name="My Name"
2.
Next put your all system variables in file /home/user/.environment_variables (any file you want)
My looks like:
export COCOS_ROOT=/home/user/Projects/edukoala
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
3.
Now you can delete your variables in .bashrc and put line
source /home/user/.environment_variables
Everything works fine :)

As pointed out in https://github.com/atom/atom/issues/7045, the environment variables can be loaded automatically, without explicit source ~/.bash_profile by using
#!/usr/bin/env bash -l
instead of
#!/bin/bash
source ~/.bash_profile
after that, in both cases, follows
exec "`dirname \"$0\"`/eclipse" $#
It works great for me, thanks for all previous work.

After setting env variables in .bash_profile.
Simply open the application through terminal!
open /Application/{path/to/app}.app

Related

VSCode complains that resolving my environment takes too long

When I launch VSCode from the dock, it always complains that
Resolving your shell environment is taking very long. Please
review your shell configuration.
and then a bit later
Unable to resolve your shell environment in a reasonable time.
Please review your shell configuration.
According to this page, Resolving Shell Environment is Slow, the first message is displayed if .bashrc takes more than three seconds and the second is displayed if it takes longer than ten seconds.
I opened a terminal in VSCode and sourced my .bashrc file
dpatterson#dpconsulting$ time source ~/.bashrc
real 0m1.448s
user 0m0.524s
sys 0m0.671s
dpatterson#dpconsulting$
As you can see, it takes less than 1.5 seconds.
Environment:
MacOS Mojave 10.14.6
VSCode 1.53.0
Hopefully someone knows what is causing this.
Barring that, maybe someone can point me to the code that actually generates these errors.
TIA
encountered the same situation and find the issue:
https://github.com/microsoft/vscode/issues/113869#issuecomment-780072904
I extract nvm load code to the condition function ref in the issue, solved this problem:
function load-nvm {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
}
# nvm
if [[ "x${TERM_PROGRAM}" = "xvscode" ]]; then
echo 'in vscode, nvm not work; use `load-nvm`';
else
load-nvm
fi
Open VS Code from a terminal:
code .
Restarting VSCode on BigSur works for me.
You can also check your user settings to make sure it matches the path of the shell that your terminal uses.
Check https://code.visualstudio.com/docs/supporting/troubleshoot-terminal-launch for other troubleshooting steps.
OSX Work-around
Background
If VS Code is started via an OSX (or Linux) GUI interface and there's a shell rc process that takes more than 10 seconds to complete during start-up (e.g. nvm) VS Code simply stops trying to start-up that shell.
Work-around
The two known solutions are to either get rid of the process that takes more than 10 seconds or start VS Code from the command line (i.e. code .).
This work-around is for those of us on OSX who —for whatever reason— explicitly don't/can't get rid of the 10+ second process and who —again, for whatever reason— start VS Code via the GUI.
While the following is less desirable than VS Code just having a configuration that we can change, it's still better than having to remember to run code . from the terminal, and it's much, much better than not using nvm (or switching to an alternative).
Note: The file extension does need to be changed between .command and .app several times — this is not a mistake! ;)
Create a new file with the following:
#!/bin/sh
code .
Save the file with a .command extension in your "Applications" directory, e.g. ~/Applications/vs-code-cli-starter.command.
In a terminal, change that new file's permissions:
chmod +x fileName.command
From Finder, right click-on your new app/command and select "Get Info", then repeat with your actual VS Code application.
Drag the big icon from the "Preview" section of the actual VS Code's "Get Info" to the small icon in the upper-left of your newly created app/command's "Get Info".
Close the two "Get Info" panels.
In the "Applications" directory, update the file extension from .command to .app, e.g. vs-code-cli-starter.app.
Drag the newly created app's icon to your dock.
In the "Applications" directory, swap the file extension back from .app to .command, e.g. vs-code-cli-starter.command.
Enjoy
For Linux:
if [[ "$VSCODE_PID" = "" ]]; then
echo "slow or blocking operations"
fi
Thanks to Hemisu's answer.
For those who uses zsh, .ohmyzsh and powerlevel10k prompt:
Get all your exports EXCEPT export ZSH= and nvm stuff and put them in the bottom of .zshrc file.
Insert this line at the top: if [[ "$VSCODE_PID" = "" ]]; then
Before your exports at the bottom, insert an fi (end if)
Now, all your ohmyzsh, nvm and ohmyzsh themes are not loaded when VSCode initializes (the built in terminal still works fine, with ohmyzsh).
In my case, outside that if/fi there is only exports for PATH, LDFLAGS and CPPFLAGS.
Thanks to M Imam Pratama answer.
In Linux, you can open "alacarte" and make a new shortcut with the command "code" and click the box "Open in a terminal".
Go to project location and open with code . in terminal (if you are in linux) or cmd (if you are in windows.) That should resolve this issue.
When directly opened from vscode app it happens, even I have faced this.
it's a very common error or we can say complain by vs code
so here is the solution - do not open vs code directly from its icon or directly from application instead you can do is just open vs code from terminal/cmd obviously for linux/windows respectively by typing this command -> $ code .
if this command is not working then reinstall the vs code and check all the boxes before installing it will also allows you to open vs code from folder directly by clicking right side of mouse and just click open this folder with other application and select vs code.

How to automatically set environment variable for eclipse terminal view?

I use the terminal view in eclipse:
Every time I start the terminal I run a command to set an environment variable, e.g.
SET HTTPS_PROXY=***.**.***.***:****
I need this as a prerequisite to be able to download some python packages with the python package manager, e.g
pip install mesa
=> Is there a way to automatically run a "startup command" when the Eclipse terminal is opened?
I expected that there would be some Eclipse setting to configure the environment variables for the terminal or to specify some initialization script. However, I could not find such a setting.
I tried to set the proxy settings in eclipse.ini
-Dhttp.proxyHost=***.**.***.***
-Dhttp.proxyPort=****
-Dhttp.nonProxyHosts=localhost|127.0.0.1
However, that does not seem to influence the proxy for the terminal view.
(I actually use a portable version of eclipse with EclipseProtable and in EclipsePortable.ini I am already able to specify some extra paths that will be known when I open a terminal view, e.g.
AdditionalPaths=./App/WinPython/python-3.7.2.amd64;
Also see https://portableapps.com/node/32861 for informatino about EclipsePortable
However, I was not able to set envirionment variables in the ini file EclipsePortable.ini.
)
You can use your system environment variable.
In Windows search the "User Account" parameter.
It must show your current account, search for "Environment variable".
Now you can set all the variables you need and they will be used by default in any terminal in Eclipse (restart Eclipse if it was running).

Ubuntu on Windows as VS Code terminal - executable path

There is a related question but it details the approach for WSL, in newer versions of Windows, the Linux distributions are not beta anymore and they are provided through the MS app store.
Where do I find the path to Ubuntu on Windows executable? (Not WSL.) I tried right-clicking on the icon to find Properties, but it is not there, it seems to be some special kind of a shortcut.
If you have multiple distros installed, you can read this how to launch one individually.
https://msdn.microsoft.com/en-us/commandline/wsl/wsl-config
However if you only have 1 installed, it will pick that one by default
There are three ways to launch and run WSL:
wsl.exe or bash.exe
wsl -c [command] or bash -c [command]
[distro] ie ubuntu -- this is the same as launching the installed app from the Windows menu.
In the first two cases, WSL must pick a distribution to run - a default distribution. If you don't explicitly set a default, it will be the first one installed.
So you can continue to simply use bash.exe
Open VSCode Settings Ctrl + , or File > Prefrences > Settings
User Settings will open up. Add the following in that file:
"terminal.integrated.shell.windows": "C:\Windows\System32\bash.exe"
Save and close the user settings file.
Enjoy bash in VSCode!

Set global $PATH environment variable in VS Code

I'm defining a custom $PATH environment variable in my ~/.bash_profile (on a Mac), like so:
PATH="$HOME/.cargo/bin:$PATH:$HOME/bin"
However, VS Code of course does not run my .bash_profile, so it does not have my custom paths. In fact, if I Toggle Developer Tools and check process.env.PATH, it doesn't even seem to have /usr/local/bin.
How do I globally set the $PATH environment variable in VS Code?
(I want to set it globally, not per project or per task, since I'm maintaining a lot of small packages.)
If you only need the $PATH to be set in the integrated terminal, you can use VS Code's terminal.integrated.env.<platform> variable (added in version 1.15). Press Cmd+Shift+P (or Ctrl+Shift+P) and search for "Preferences: Open Settings (JSON)". Then add the following entry to the settings file:
"terminal.integrated.env.osx": {
"PATH": "...:/usr/bin:/bin:..."
}
(Replace .osx with .linux or .windows as needed.)
To see your system's $PATH, type echo "$PATH" in Terminal.app, and copy and paste it into the settings snippet above.
As for having the $PATH available everwhere in VS Code, so that it will
be used by extensions that call binaries, the only workaround I've found so far is this:
Configure your shell (bash by default) to have the $PATH you want. For example, my ~/.bash_profile has the following line:
PATH="$PATH:$HOME/bin"
In VS Code, press ⇧⌘P and type install 'code' command if you haven't done so before.
Quit VS Code.
Launch VS Code not by clicking the icon in the dock or in Launchpad, but by opening Terminal.app and typing code. Your newly set path will be active in VS Code until you quit it.
If VS Code restarts, for example due to an upgrade, the $PATH will reset to the system default. In that case, quit VS Code and re-launch it by typing code.
Update: VS Code on Mac and Linux now apparently tries to automatically resolve the shell environment when it is started by clicking the icon (rather than via code). It does this by temporarily starting a shell and reading the environment variables. I haven't tested this though.
In:
> Preferences: Open Settings (JSON)
add to the JSON file:
"terminal.integrated.env.windows": {
"PATH": "${env:PATH}"
},
-> terminal.integrated.env should end with .osx, .linux or .windows depending on your OS.
In order to check if it works execute in your VS Code Terminal:
# For PowerShell
echo $env:PATH
# For bash
echo "$PATH"
I am using vscode on macos for C/C++ development in conjunction with CMake.
The vscode extension CMake Tools allows to manipulate environment variables via the configuration properties cmake.configureEnvironment, cmake.buildEnvironment and cmake.environment (acting respectively on the CMake configuration phase, the build phase and both - see docs).
Then you can extend your system PATH with custom paths by adding the following snippet to your user or project settings.json:
"cmake.environment": {
"PATH": "~/.myTool/bin:${env:PATH}"
},
Visual Studio Code is the problem.
No matter how you set your PATH variable in the shell, there are cases where Visual Studio Code will not inherit your PATH setting. If you're using an application launcher like LaunchBar to start Visual Studio Code, your PATH variable will not be inherited.
Here is a system-wide fix:
In the /etc/paths.d directory, create a file with your Unix username. In that file, place the additional paths that Visual Studio Code needs to work. In my case, this is the contents of my /etc/paths.d file:
/usr/ucb
/opt/local/bin
/opt/local/sbin
~/go/bin
Note: Your /etc/paths.d file will be processed system-wide. Since most systems are single-user, this shouldn't be a problem for most developers.
Since this is the top Google search result for variants of "VS Code path", I will add my answer here.
I'm running Linux and my problem was that VS Code couldn't find some executable needed to build my project. I was running VS Code from the quick launcher (ALT+F2), and not from a Terminal. I tried modifying the PATH variable in many different places, but I couldn't seem to get it right.
In the end, placing the right PATH inside of ~/.zshenv is what worked. It's because .zshenv is the only file that gets sourced for non-interactive shell command execution like from inside of VS Code (more detailed explanation here https://unix.stackexchange.com/questions/71253/what-should-shouldnt-go-in-zshenv-zshrc-zlogin-zprofile-zlogout )
This was even easier to fix than the above answers suggested.
Open VSCode Settings (Ctrl + ,) and search for terminal.defaultProfile.
I updated my Terminal > Integrated > Default Profile: Windows.
It was set to null by default. As soon as I changed it to PowerShell and restarted the terminal, it picked up my system's path variables!
What did the trick in my case (Linux Mint 19.3 Cinnamon, VS code installed via snap) was to put my appended PATH in ~/.profile . Since this file is read at the beginning of a user session, don't forget to logout/login or reboot after editing this file.
I'm working with ubuntu 18.04. I had a similar problem, my enviroment variables were defined and the terminal knows the $PATH but when I tried to debug with golang, go libraries were not found in $PATH variable.
So, to solve it I uninstall the default version from ubuntu software and install manually using the following instructions:
https://code.visualstudio.com/docs/setup/linux
It works for me.
As of VS Code v1.63.2, you can proceed with Ctrl + Shift + P and then type Open Settings (JSON), and simply add the following line.
"terminal.integrated.inheritEnv": true
In my case the code was already there, but set to false. After changing it, everything was fine.
Getting Code to load your existing ~/.bash_profile would be best. I think the docs here are the relevant reference:
https://code.visualstudio.com/docs/editor/integrated-terminal#_linux-os-x
Typically $SHELL is your primary shell on Unix-like systems so you
probably won't want to change the shell. You can pass arguments to the
shell when it is launched.
For example, to enable running bash as a login shell (which runs
.bash_profile), pass in the -l argument (with double quotes):
// Linux "terminal.integrated.shellArgs.linux": ["-l"]
// OS X "terminal.integrated.shellArgs.osx": ["-l"]
Although, it looks like that setting is the default on my current VS Code (OS X) setup. Integrated terminal is running my ~/.bash_profile without any changes to the configuration. Perhaps try adding echo Executing .bash_profile... to test if it's running when a new terminal is opened in Code.
Add the following to your ~/.bash_profile:
launchctl setenv PATH $HOME/.cargo/bin:$PATH:$HOME/bin
Or run a Bash script when needed, e.g.:
#!/bin/bash
set -Eeuxo pipefail
proj_path=$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
launchctl setenv PATH $proj_path/bin:${PATH:-}
For me it's resolved by editing the .desktop file.
Originally I have
Exec=/usr/bin/code-oss --unity-launch %F
. Just changed to
Exec=zsh -c "source ~/.zshrc && /usr/bin/code-oss --unity-launch %F"
since I use zsh, instead of bash. But if you have the same problem with bash, simply replace zsh with bash. And shortcuts from your desktop environment should be fixed.

Open multiple Eclipse workspaces on the Mac

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?
This seems to be the supported native method in OS X:
cd /Applications/eclipse/
open -n Eclipse.app
Be sure to specify the ".app" version (directory); in OS X Mountain Lion erroneously using the symbolic link such as open -n eclipse, might get one GateKeeper stopping access:
"eclipse" can't be opened because it is from an unidentified developer.
Your security preferences allow installation of only apps from the Mac App Store and identified developers.
Even removing the extended attribute com.apple.quarantine does not fix that. Instead, simply using the ".app" version will rely on your previous consent, or prompt you once:
"Eclipse" is an application downloaded from the Internet. Are you sure you want to open it?
By far the best solution is the OSX Eclipse Launcher presented in http://torkild.resheim.no/2012/08/opening-multiple-eclipse-instances-on.html It can be downloaded in the Marketplace http://marketplace.eclipse.org/content/osx-eclipse-launcher#.UGWfRRjCaHk
I use it everyday and like it very much! To demonstrate the simplicity of usage just take a look at the following image:
EDIT: Milhous's answer seems to be the officially supported way to do this as of 10.5. Earlier version of OS X and even 10.5 and up should still work using the following instructions though.
Open the command line (Terminal)
Navigate to your Eclipse installation folder, for instance:
cd /Applications/eclipse/
cd /Developer/Eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Users/<usernamehere>/eclipse/jee-neon/Eclipse.app/Contents/MacOS
Launch Eclipse: ./eclipse &
This last command will launch eclipse and immediately background the process.
Rinse and repeat to open as many unique instances of Eclipse as you want.
Warning
You might have to change the Tomcat server ports in order to run your project in different/multiple Tomcat instances, see Tomcat Server Error - Port 8080 already in use
To make this you need to navigate to the Eclipse.app directory and use the following command:
open -n Eclipse.app
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.
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.
2018 Update since many answers are no longer valid
OS X Heigh Sierra (10.13) with Eclipse Oxygen
Go to wherever your Eclipse is installed. Right-click -> Show Package Contents -> Contents -> MacOS -> Double-click the executable called eclipse
A terminal window will open and a new instance of eclipse will start.
Note that if you close the terminal window, the new Eclipse instance will be closed also.
To make your life easier, you can drag the executable to your dock for easy access
Instead of copying Eclipse.app around, create an automator that runs the shell script above.
Run automator, create Application.
choose Utilities->Run shell script, and add in the above script (need full path to eclipse)
Then you can drag this to your Dock as a normal app.
Repeat for other workspaces.
You can even simply change the icon - https://discussions.apple.com/message/699288?messageID=699288&#699288
One another way is just to duplicate only the "Eclipse.app" file instead of making multiple copies of entire eclipse directory. Right-Click on the "Eclipse.app" file and click the duplicate option to create a duplicate.
If you're like me, you probably have terminal running most of the time as well.
You could just create an alias in /Users//.bash_profile like this
alias eclipse='open -n path_to_eclipse.app'
then all you have to do is just open the terminal and type eclipse.
Based on a previous answer that helped me, but different directory:
cd /Applications/Eclipse.app/Contents/MacOS
./eclipse &
Thanks
You can create an AppleScript file to open Eclipse with a given workspace. You can even save the AppleScript file as an Application, which is equivalent to creating an alias with arguments in Windows OS.
Open Script Editor and type the following:
do shell script "open '/path/to/your/Eclipse/installation' -n --args -data /path/to/your/workspace"
For instance:
do shell script "open '/Applications/Eclipse.app' -n --args -data /MyWorkspaces/Personal"
Press the Run button to check it's working.
This script can be saved as such, but I prefer to save it as an Application. That way I can customize the icon by copying the *.icns icon from the original Eclipse.app bundle to the script application bundle.
To open an App folder, use the "see contents" contextual menu option. It should look like this:
Where "main.scpt" is the AppleScript file and "applet.icns" is the icon from the original Eclipse bundle.
Launch terminal and run open -n /Applications/Eclipse.app for a new instance.
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.
In Terminal simply paste below line and hit enter ..
/Applications/Eclipse.app/Contents/MacOS/eclipse ; exit;
If you want to open multiple workspaces and you are not a terminal guy, just locate the Unix executable file in your eclipse folder and click it.
The path to the said file is
Eclipse(folder) -> eclipse(right click) -> Show package
Contents -> Contents -> MacOs -> eclipse(unix executable file)
Clicking on this executable will open a separate instance of eclipse.
A more convenient way:
Create an executable script as mentioned above:
#!/bin/sh
cd /Applications/Adobe\ Flash\ Builder\ 4.6
open -n Adobe\ Flash\ Builder\ 4.6.app
In you current instance of Flashbuilder or Eclipse, add a new external tool configuration. This is the button next to the debug/run/profile buttons on your toolbar. In that dialog, click on "Program" and add a new one. Give it the name you want and in the "Location" field, put the path to the script from step 1:
/Users/username/bin/flashbuilder
You can stop at step 2, but I prefer adding a custom icon to the toolbar. I use a the Quick Launch plugin to do that:
http://sourceforge.net/projects/quicklaunch/files/
After adding the plugin, go to "Run"->"Organize Quick Lauches" and add the external tool config from step 2. Then you can configure the icon for it.
After you save that, you'll see the icon in your toolbar. Now you can just click it every time you want a new Flashbuilder/Eclipse instance.
You can run multiple instances of Eclipse by creating a pseudonym for Eclipse application in it's folder and using it for running new Eclipse instance
Lets try downloading this in your eclipse on Mac you will be able to open multiple eclipse at a time Link
Name : macOS Eclipse Launcher
Steps :
Go to eclipse Market place.
Search for "macOS Eclipse Launcher" and install.
It will restart .
Now under file menu check for open option > there you will find other projects to open also at same time .
Window -> New Window
This opens a new window and you can then open another project in it. You can use this as a workaround hopefully.
It actually allows you to work in same workspace.