Skip to content

How to set up an IDE for debugging Ruby extensions in SketchUp

Thomas Thomassen edited this page Nov 30, 2017 · 6 revisions

Note: More up to date instructions can be found at: https://github.com/SketchUp/sketchup-ruby-api-tutorials/wiki


As with any software installation, please follow these instructions at your own risk. They are simply our setup experiences documented and they may or may not work for your specific setup.

Install and configure Aptana RadRails

  • Download the “Standalone” version of Aptana RadRails from http://www.aptana.com/products/studio3/download

  • Run the installer, accept the default options.

  • Run Aptana Studio 3

  • It will ask to Select a Workspace. You may choose the default and check “Do not ask again”

  • When the program starts, select File/New/Ruby Project

  • Pick Default Project, then Next.

  • Enter a project name, for instance “2014 Plugins”

  • For “Location:”, browse to your SketchUp 2014 Plugins folder, it will be C:\Users<username>\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins

  • You’ll get a red warning text indicating that you may lose your code if you delete this project. So that is something to be aware of.

  • Select the “I’ll generate my own code…” radio button, which should be selected already.

  • Click Finish

  • Go to Run/Debug Configurations…

  • You’ll see a list box on the left with different config options. Select “Remote Ruby Debug Session”

  • Click on the “New Launch Configuration” button (shown below)

  • Enter a name for the configuration, such as “SketchUp”

  • Under the Main tab, you can change the Host address which defaults to 1234. Note that the Ruby Debugger DLL also defaults to 1234 if you do not enter a port, so you may leave it as is.

  • Under the Common tab, check Debug inside the “Display in favorites menu” section (as shown below)

  • Click Close and click Yes on the Save Changes dialog.

  • Now SketchUp will show up as a Debug option on the Debug toolbar (see below) and under Run/Debug History. You can launch remote debugging by clicking this menu item.

Install and configure NetBeans

  • Download Java JDK version 7 or later if you don’t already have it installed. Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and download the latest Java SE Development Kit for Windows (the x64 version if your OS is 64-bit).

  • Install Java JDK by accepting the default options.

  • Go to http://netbeans.org

  • Download the C/C++ version of NetBeans IDE and install it by accepting the default options. - On the NetBeans website, click on the Plugins link above, search for “ruby” and download “Ruby and Rails” for NetBeans 7.4. Extract the downloaded zip file somewhere.

  • Launch NetBeans. Click Tools menu->Plugins. Select the “Downloaded” tab. Click “Add Plugins…”

  • A File Open dialog will be shown. Navigate to the folder where you extracted the plugin zip file. Go down to the archive/build/updates subfolder. Change file filter to “All Files”. Then select all .nbm and .jar files in the list, click Open.

  • Click Install on the Plugins dialog.

  • Several dialogs will come up. Answer yes to everything and ignore any warnings. It will eventually ask to Restart the IDE. Click Finish and let the IDE restart.

  • Once the IDE restarts, click File->New Project

  • Choose Ruby / Ruby Application with Existing Sources -> Next

  • Enter a Project Name such as “SU2014 Plugins”. Point “Project Folder” to your SU2014 plugins folder. The “Ruby Platform” selection doesn’t seem to matter but if you have a local Ruby installation, choosing that will avoid a warning later about Rake. Click Finish.

  • You should now see an IDE view as shown below. You can click on the “Files” tab on the left, open an rb file and add a breakpoint somewhere (Ctrl+F8)

  • After launching SketchUp for debugging, go to NetBeans and click Debug->Attach Debugger…

Make sure Debugger is set to “Ruby Debugger (ruby-debug-ide)” and Port matches the command line argument you passed to SketchUp.

  • When a breakpoint is hit, you should see that in the IDE. Note that NetBeans doesn’t come on top when a debugger event happens so it’s best to keep the debugger on a different monitor if possible.

Also note that NetBeans seems to have a bug where the Variables window doesn’t always update properly and you need to switch to another tab and switch back.