Skip to content

Installing Eclipse with Subversion for PHP and Javascript Development on Mac OS X

308eclipseappleMac OS X 10.6 Snow Leopard comes with the 64bit version of Java 1.6 installed by default. Unfortunately, Eclipse 32bit and older subeclipse plugins are not 100% compatible with the 64bit version of Java 1.6. You may encounter errors when using Eclipse such as “Unable to load default SVN client” (which can be solved by installing JavaHL), and an unknown exception when creating a “project from svn” (you’ll need Eclipse 64bit to fix this). The best, simplest solution is to get the latest version of Eclipse Cocoa 64bit for Mac OS X, codenamed Galileo.

Installing JavaHL Library (Pre-requiste for Subclipse)

In order for subclipse to work on your Mac OS X machine, you will need to download and install the JavaHL which provides a JNI binding layer from Java to the subversion binaries. The quickest way is to just install the latest subversion binaries, which includes the JavaHL library.

  1. Double-check what is installed on your Mac OS X by opening a Terminal and running the following:
    java -version
    svn --version
    ls /Library/Java/Extensions

    The last should show a symbolic link to the JavaHL library if you have a version installed.

  2. To install the latest subversion and JavaHL, go to Collabnet Website.
  3. Select the appropriate subversion binaries for your Mac OS X version; currently “Subversion 1.6.9 Universal”.
  4. You can leave the contact info form blank and just hit the Submit button to download the .dmg image (ex: Subversion-1.6.9-10.6.x.dmg)
  5. Check that the /opt directory (which is a symbolic link to “/private/opt”) exists. If not, you can create it by running this command:
    sudo ln -s /private/opt /opt
  6. Launch the .dmg image and double-click on the subversion icon to install the binaries into the default “/opt/subversion” directory.
  7. Once installed, you will need to prepend “/opt/subversion/bin” to your PATH environment variable. Open up your bash environment profile “~/.profile” and add this line:
    export PATH=/opt/subversion/bin:$PATH

    Note that the path separator is a colon, not a semi-colon (used by Windows).

  8. Double-check that the JavaHL library is accessible. You should find a symbolic link (ex: “libsvnjavahl-1.jnilib”) for the JavaHL library in the “/Library/Java/Extensions” directory. This is the global location that the Mac OS X JVM will look for when loading libraries via JNI.

Install Eclipse Cocoa 64bit

  1. Get the Mac OS X Cocoa 64bit version of Eclipse.
    • Go to the Eclipse Downloads page.
    • Find “Eclipse IDE for Java Developers” and click on the Mac Cocoa 64bit link to the right.
  2. Unzip the downloaded .gz archive and copy the resulting expanded eclipse directory to your /Applications directory.
  3. Go to the “/Applications/eclipse” directory and run the “eclipse” program.
  4. Install Subclipse for Subversion integration
    • Go to Eclipse menu Help->Install New Software…
    • Input “http://subclipse.tigris.org/update_1.6.x” into the “Work with” field and the table will be updated with installation packages available at that location.
    • Check just the Subclipse package and keep clicking Next until the end. Half-way through, you will be asked to accept the license agreement.
    • If you wish Eclipse to remember the URL, hit the Add button and name it “Subclipse”.
  5. Install PHPEclipse, also known as PHP Development Tool (PDT), for PHP Development
    • Input “http://update.phpeclipse.net/update/stable/1.2.x” (evidently, “http://phpeclipse.sourceforge.net/update/stable/1.2.x/” is the same URL) into the “Work with” field.
    • Just pick PHPEclipse. If you want to debug, install DBG or XDebug. (I haven’t tried XDebug yet so I can’t recommend DBG over it.)
  6. Install JSDT (Javascript Development Tool) for Javascript Development
    • JSDT is a part of the Eclipse Web Tools Platform (WTP) repository. Input “http://download.eclipse.org/webtools/updates” into the “Work with” field.
    • Locate (but don’t check) the latest WTP (Web Tools Platform); currently “Web Tools Platform (WTP) 3.1.2”.
    • Click on the right-facing arrow (to the immediate right of the checkbox) to expand the packages inside the WTP.
    • Check just the “Javascript Development Tools” and click Next, etc.

Uninstalling Subversion and Eclipse

  • To uninstall Subversion, just remove the “/opt/subversion” directory, remove the /Library/Receipts/Subversion-1.6.9.pkg directory, and delete the JavaHL symbolic link at “/Library/Java/Extensions/libsvnjavahl-1.jnilib”.
  • To uninstall Eclipse, just remove the “/Applications/eclipse” directory.

6 Comments

  1. THX! That made my day 🙂

  2. Jeff Clough

    “java –version” should be “java -version”. Typos like this are really troublesome for the type of noob (like me) who needs the information on this page.

    • Chanh

      Good catch! I’ve removed the extra dash character.

  3. Luciofer

    OMG this post is killer! I spent a week trying to install PHP+SVN on my new Snow Leopard 10.6 and following these steps made it perfectly!
    Thank you very much!!

  4. gregorius

    Once installed, you will need to prepend “/opt/subversion/bin” to your PATH environment variable. Open up your bash environment profile “~/.profile” and add this line:

    Could someone walk me through this line? I’m not sure where the bash environment profile is.

    • Chanh

      Hi, the “~/.profile” refers to the file containing your bash environment variables. The ~ character is an alias for your home directory, such as “/Users/yourusername”. You will need to edit the “.profile” file by using a text editor such as the TextEdit application. You can run TextEdit and open “~/.profile”. Or you can run the Terminal and input this command “open -a TextEdit ~/.profile”. Good luck.

Leave a Reply

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