D for Xcode
Download
-
D plugin for Xcode 1.1b2 (740 Kb)
- Most recent update of the D plugin for Xcode. September 21, 2008.
-
Source code 1.1b2 (1.6 Mb)
- Source code for building the plugin on your own.
You can track the developement of this project using the Git repository mirror accessible from git.michelf.com.
Note: Support for Xcode 3 is still incomplete in regard to syntax highlighting.
Introduction
This D plugin for Xcode makes it easy to develop tools, libraries, and applications in the D programming language using Apple’s Xcode IDE. The plugin does the following things:
It adds to Xcode the GDC D compiler and the appropriate build rules so that D source files are recognised and are as easy to compile as C, C++, and Objective-C ones. Once you’ve added a D source file to a project or target, options specific to the D compiler will apear in the build settings.
It allows Xcode to track dependencies between files (by looking for
importdeclarations) and automatically recompile files when a dependency has been modified.It allows the Xcode debugger to work with D files: setting breakpoints and stepping thru the code works as you’d expect it.
It provide “perfect” syntax highlighting using the lexer from Digital Mars’ D front end.
It populates the Code Sense editor function popup with functions, classes, and some other constructs the D front end parser can find in your D source file.
It provide icons for .d and .di files in the Finder and elsewhere on the system, and it allows D files to open with Xcode by default. On Mac OS X 10.5 Leopard, D files are opened in Xcode 2.5 since this plugin does not support Xcode 3.
Requirements
- Mac OS X 10.4 with Xcode 2.4.1 or 2.5
- Mac OS X 10.5 with Xcode 2.5 or Xcode 3
Note: Support for Xcode 3 is still incomplete in regard to syntax highlighting.
Installation
- For Xcode 2.4.1:
- Take the downloaded “D for Xcode.xcplugin” file to the “/Library/Application Support/Apple/Developer Tools/Plug-ins” folder (create the folder if you need to), and relaunch Xcode.
- For Xcode 2.5 and Xcode 3:
- Take the downloaded “D for Xcode.xcplugin” file to the “/Library/Application Support/Developer/Shared/Xcode/Plug-ins” folder (create the folder if you need to), and relaunch Xcode.
Alternatively you can install the plugin in the Library folder in your own user account.
Once this is done, you can create D files and add them to the desired targets in your Xcode projects, and they should compile and link fine.
Note: On Xcode 3 you’ll need to get info on your files and select “sourcecode.d” as the file type. Otherwise Xcode 3 interprets files with the .d extension as dtrace files. This is noted in the known issues.
Screenshots
Known Issues
Nested comments and documentation comments are ignored by the syntax highlighter in Xcode 3.
Files with the .d extensions are given the “sourcecode.dtrace” type instead of “sourcecode.d” while first added to a project. This is because Xcode already has a rule associating .d files with dtrace which takes precedence. You must open the info panel for your files and manually select the “sourcecode.d” file type. This does not apply to Xcode 2.x.
The debugger doesn’t demangle function names. This can probably be fixed by patching GDB.
The debugger does not show very intelligently the content of objects.
Compiling with a SDK under Xcode 2.4.1 generates an innocuous missing directory warning when linking. You can add an empty directory at the specified path in the SDK to remove that warning, or you can upgrade to Xcode 2.5 which seem to no longer exhibit this behaviour.
About Module Directories
The compiler and the dependency checker assumes the module directory you’re working with is the directory project directory. This means that a module named mypackage.mymodule must be located at PROJECT_DIR/mypackage/mymodule.d. You can add other module directories (if you want to include libraries for instance), but the dependency graph doesn’t take them into account and your files depending on them won’t be recompiled automatically if you change them (you’ll need to clean the target first). Let me know if this is a problem for you.
Bug Reports
If you find a problem, whether it’s crashing Xcode or not, I’d like to know about it. Please give me any relevant information (such as Xcode crash logs if Xcode crash) and the appropriate steps, or files, to replicate the problem (so I can debug it locally). You can send bug reports at this address: michel.fortin@michelf.com.
License
D for Xcode is available under the GNU General Public License, version 2 or later.
Version History
D for Xcode 1.1b2 (21 Sep 2008)
Improved code folding.
Fixed a problem where a wrong linker command was issued under Xcode 3.1.
D for Xcode 1.1b1 (31 May 2008)
Updated the build process and other parts of the plugin to work with Xcode 3 on Leopard. The plugin continue to work with all previously supported versions of Xcode (2.4 and 2.5).
Created a new set of rules for syntax highlighting suitable for Xcode 3 with support for code folding.
D for Xcode 1.0.1 (November 23, 2007)
- The plugin now registers its launcher application when loaded into Xcode. Previously it was counting on the Finder to register it while copying the plugin, but that isn’t always reliable; hence the need for a backup plan.
D for Xcode 1.0 (November 20, 2007)
- First non-beta release.

