Run Eclipse from the Command Line on OS X

If you’re looking to launch Eclipse passing in the -clean parameter on OS X you’ll want to cd into the eclipse directory that contains your Eclipse.app package and use the following syntax in bash or your favorite shell terminal:

./eclipse -clean -vmargs -XstartOnFirstThread

The arguments following ./eclipse are all passed to Eclipse and the arguments following -vmargs are passed to the Java jvm.

run Eclipse on OS X from commandline

As an alternative you can modify the Eclipse ini file (see image below for ini location). If you alter the ini file, the arguments set there will be passed in each time Eclipse is run as opposed to a one time deal with the command line.

Eclipse ini location

Why would you want to use the -clean argument? According to the documentation the -clean argument provides the following:

Cleans cached data used by the OSGi framework and Eclipse runtime. Try to run Eclipse once with this option if you observe startup errors after install, update, or using a shared configuration.

Newly installed plugins will often not work until Eclipse has been run with the -clean parameter. After a good chunk of time the Eclipse workspace may also become corrupt and -clean can sometimes work wonders. If you’re having Eclipse workspace issues check out Riyad Kalla’s excellent article.

Finally, if you’re like me and have hard time remembering where in the Eclipse help documentation you kind find all of the Eclipse startup arguments and their uses the Jing screengrab below should help.

Eclipse startup arguments / parameters

5 thoughts on “Run Eclipse from the Command Line on OS X

  1. It’s about time you posted something new! Thanks for sharing this information. It will be invaluable in future projects:)

  2. Thanks this article atleast got me started on how to use command line arguments. I was having a really hard time trying to figure that out.

    Thanks again

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>