So, the eclipse performance on OSX was bugging me enough that I decided to try getting the eclipse GTK port running on OSX. The idea being that eclipse GTK runs pretty good on linux these days, so it should run similary well on OSX.


So, the eclipse performance on OSX was bugging me enough that I decided to try getting the eclipse GTK port running on OSX. The idea being that eclipse GTK runs pretty good on linux these days, so it should run similary well on OSX.



Well, I was partially right. While it does run a lot faster than carbonized eclipse, there are a bunch of UI glitches that make it less usable for me. I'm hoping that if I document how I got it to work, maybe someone else can do the grunt work of trying out other alternatives that may fix the problems I am having. If you do, I'd appreciate the feedback.



First some pre-requisites. You'll need to have a X server installed and the gtk libraries. I'm using the Apple X server (from OSX 10.4 install CD), and used fink to install all the gtk libraries I needed - in fink-commander, install everything with gtk+ in the name.



Next, get the eclipse linux-gtk 3.1 release and extract it to the directory of your choice (I used /Applications/eclipse-swt. This makes for an easy starting point since I didn't feel like creating a new eclipse port and building from scratch.



There are really only 3 native components we need to worry about replacing, two of which are optional. The launcher we can bypass by using java to launch eclipse, and the org.eclipse.core.resources.linux only improves filesystem performance, defaulting to java.io.File if the native library is not present. The only one we really need to do anything for is the swt plugin. Fortunately, one of the eclipse developers recently ported/compiled the swt-gtk libraries for OSX, and you can fetch them from here.



Now you need to extract the swt plugin into a directory of the same name:

cd <eclipseInstall>/plugins; unzip -d org.eclipse.swt.gtk.linux.x86_3.1.0 org.eclipse.swt.gtk.linux.x86_3.1.0.jar

Remove the jar when you are done. Next you need to copy the osx-swt-gtk *.jnilib files from the above download into the directory you just created. I also deleted the existing binaries from that directory to be safe.



Finally, to run eclipse, you have to use the command line to run the java launcher directly. Make sure your X server is running, and the shell you are running from has the DISPLAY=:0 environment set. Then the command to run eclipse is

java -cp <eclipseInstall>/startup.jar org.eclipse.core.launcher.Main -clean -os linux -ws gtk -arch x86 -vmargs -Xmx512M
Note that I specified linux/gtk/x86, which seems counter intuitive, but thats the download we started from. Also, you probably don't want to use an existing workspace, so pick an empty directory for your workspace location.



Now, assuming I didn't miss anything (let me know if I did), your eclipse should fire right up using swt-gtk.



Issues I have



  • Dialogs are all weird sizes/layouts, no idea how to fix them. Especially broken is the Find dialog (ctrl-f in an editor)


  • Related to dialogs, but more annoying to my work habits, the ctrl-f6 used for switching between editors is unreadable because its too small.




Things to do


  • Billy Biggs (eclipse guy who made the binaries) mentioned on eclipse.platform.swt newsgroup that fonts may be to blame, could be worth investigating.

  • Try a different X-server, maybe a more recent build of Xfree/Xorg from fink or darwinports would fix some of the dialog issues

  • Try some different window managers - I only tried the built in apple one and gnome-metacity, both exhibited same funky dialogs

  • If other issues are resolved acceptably, might be worthwhile to do the full macosx/gtk/ppc port using the eclipse source distribution. At the very least, the core.resources binary from linux/gtk/x86 should be recompiled in the same way swt libs were so that we don't suffer when doing a workspace refresh.