I am currently working solo on a project that consists of package files, munit tests, notebooks and .xls files. I use Wolfram Workbench as an IDE. I want to collaborate with others on this project. Ideally I would like to do this as I am used to do with Java: dump everything in cvs ( any system will do ) on the net and then check/out, check/in with one person as a repository admin.

Question: How should I do this with a Mathematica project? Do I need Workbench plugins? What are the particular pitfalls, if any?

  • $\begingroup$ This is why I use Eclipse + Wolfram plugin (+ Subclipse plugin + ...) rather than the Workbench. $\endgroup$ Commented May 19, 2012 at 13:19
  • $\begingroup$ That's more of a teaser like I have a setup but I am not giving it away. $\endgroup$ Commented May 19, 2012 at 15:23
  • $\begingroup$ I think @b.gatessucks answers your question. Just start using Eclipse with the Workbench plugin instead of the Workbench IDE. $\endgroup$
    – mohit6up
    Commented May 19, 2012 at 15:58
  • $\begingroup$ Did you know that TortoiseSVN as well as some other Tortoise clients derived from it (e.g. TortoiseHg) have support for diffing notebook files using the Mathematica front end? $\endgroup$
    – Szabolcs
    Commented May 21, 2012 at 11:05
  • $\begingroup$ @Szabolcs - your link doesn't work. Sounds interesting though. $\endgroup$ Commented Jan 2, 2014 at 17:09

3 Answers 3


This is how I got my setup :

  1. download Eclipse, along with all the plugins you need (svn, cdt, texlipse, ...), from www.eclipse.org ;
  2. download Eclipse plugin for workbench from http://www.wolfram.com/services/premiersupport/workbench.cgi : you will have a choice between platforms : Windows, Macintosh, Linux, Eclipse;
  3. choose the last one (eclipse) and save the file somewhere;
  4. open Eclipse, then Help->Install New Software -> Add and browse to the location of the file you saved.

The Wolfram plugin will give you all the features of the Workbench : code editor, documentation builder, webMathematica, MUnit package as you can see from the screenshot below . screenshot

  • $\begingroup$ I suppose I already have the Wolfram Plugin, or is that different from the Workbench ? $\endgroup$ Commented May 19, 2012 at 17:58
  • $\begingroup$ I think it's a different download from Wolfram's website. $\endgroup$ Commented May 19, 2012 at 18:22
  • $\begingroup$ I followed your link in the other answer and that pointed to a download of the Workbench. - I read once that the Workbench is a customized Eclipse using the same Wolfram plugin you mentioned, BUT... I am not sure. And as you say there might be a seperate download anyway. $\endgroup$ Commented May 19, 2012 at 19:44
  • $\begingroup$ The link offers 4 choices for downloading : the first three are the Workbench for the different platforms (Windows, Macintosh, Linux). The last one is called "Eclipse" and it's the plugin for the regular Eclipse I was mentioning above. $\endgroup$ Commented May 19, 2012 at 20:42
  • $\begingroup$ While the link is not likely to go away, as it is on SO, could you summarize it here? $\endgroup$
    – rcollyer
    Commented May 20, 2012 at 15:38

Here is a take for those using only the Mathematica front end and git. I recently starting using git so that I can work with other collaborators. It was relatively simple since we were using notebooks to create figures from imported data that was located in the same directory. In this case all the notebooks started with the line:


The problem happened when we needed to use other packages. I did not want to bother them with getting their own copy and to put it in $UserBaseDirectory. I figured instead that I can create a folder in the git project were I could place all of the external packages that we need and use them. Now we just need to tell Mathematica where to look for those files. Initially my collaborator used the absolute path: /Users/username/path/to/gitproject/mathematica/. This path was obviously not going to work for me. The way to do this is to declare a relative path. Since we are working in git we can use

Import["!git rev-parse --show-toplevel", "Text"]

to obtain the path to the git project. Now we can create relative paths. So now our Notebooks started with this:

MMAROOT = ToFileName[{
    Import["!git rev-parse --show-toplevel", "Text"], 
    "mathematica", "applications"}
If[! MemberQ[$Path, MMAROOT], PrependTo[$Path, MMAROOT]]

This however was getting annoying since we had to copy and paste this code every time we created a new notebook. Instead I came up with this function and put in the file $UserBaseDirectory/Kernel/init.m.

(** User Mathematica initialization file **)
EMPH[a_, style_: "TI"] := ToString[Style[a, style], StandardForm]
LINK[label_, url_] := ToString[Hyperlink[label, url], StandardForm]
USAGE[str_, inputs__] := ToString[StringForm[str, inputs], StandardForm]
GitSetup::usage = USAGE["GitSetup[`1`, `2`, ...] sets the working \
directory to the directory of the calling notebook and appends the \
inputs to `3`. The input paths are relative to the git root \
directory.", EMPH["path1"], EMPH["path2"], 
LINK["$Path", "paclet:ref/$Path"]]
GitSetup[input__] := Module[{path, gitpath, tmp},
    gitpath = Import["!git rev-parse --show-toplevel", "Text"];
    path = {input};
        tmp = ToFileName[{gitpath, path[[i]]}];
        If[! MemberQ[$Path, tmp],
            PrependTo[$Path, tmp];
        {i, Length[path]}

Now I only bother my collaborators to put that file so that every time they start Mathematica they have access to the function GitSetup. Now every notebook starts with


And in case they forget what this function does:

GitSetup usage

Now we can add or develop packages related only to the project we are working on without having to worry about any paths and without even having to call SetDirectory.

Skip the function arguments:

If your git project contains source files from other languages it might be convenient to create a .bashrc in the root git folder. This bash file should apply to all the collaborators of the group and not just yourself (you have ~/.bashrc or ~/.bash_profile for that). This is how the .bashrc file looks in the git directory (placed in the same folder as .gitignore and .gitattributes):

# Bash commands related to the git project
export GITROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PATH=$PR/bin:$PATH
export PYTHONPATH=$PR/main/python:$PR/python:$PYTHONPATH
export MATLABPATH=$PR/main/matlab:$PR/matlab:$MATLABPATH
export MMA_PATH=$PR/main/mathematica:$PR/mathematica

Whenever we want to work in the project we source that file and all the packages in the project will be available. In this way we can specify where we want Mathematica to look for packages in the git project by creating an enviroment variable. I called it MMA_PATH and added two paths to it. Now the $UserBaseDirectory/Kernel/init.m file looks as follows:

(** User Mathematica initialization file **)

EMPH[a_, style_: "TI"] := Module[{},
    ToString[Style[a, style], StandardForm]
LINK[url_, label_:Style["\[RightSkeleton]", "SR"]] := Module[{},
    ToString[Hyperlink[url, label], StandardForm]
USAGE[str_, inputs__] := Module[{},
    ToString[StringForm[str, inputs], StandardForm]

GitSetup::usage = `Private`USAGE["GitSetup[] sets the working \
directory to the directory of the calling notebook and appends the \
paths defined by `1` to `2`. The definition of `1` is found in the \
.bashrc file in the git root directory. In the event that you are \
not working in a git directory then an attempt will be made to look \
for the .bashrc file by looking in the parent directories up to your \
home directory.",
   `Private`EMPH["$MMA_PATH", "Input"],
   `Private`LINK["$Path", "paclet:ref/$Path"]

GitSetup[] := Module[{gitpath, mmapath, path, parent, bashrc},
    parent = NotebookDirectory[];
    gitpath = Import[
        "!git rev-parse --show-toplevel", "Text"
    If[gitpath != "",
        bashrc = FileNameJoin[{gitpath, ".bashrc"}];
        bashrc = FileNameJoin[{parent, ".bashrc"}];
            parent = ParentDirectory[parent];
            bashrc = FileNameJoin[{parent, ".bashrc"}];
            If[parent == $HomeDirectory,
    mmapath = Import[
        "!source " <> bashrc <> "; echo $MMA_PATH", "Text"
    path = StringSplit[mmapath, ":"];
        If[!MemberQ[$Path, path[[i]]],
            PrependTo[$Path, path[[i]]];
        {i, Length[path]}


Now the notebooks start with GitSetup[] and we are ready to work.

Deployment for non-git collaborators

If it so happens that some of your collaborators refuse to use git and prefer to use something say like dropbox, then the notebooks you produce with the command GitSetup[] will also work for them.

To share your git repository with such collaborators with dropbox all you have to do is create a symbolic link from your git repository to a folder in dropbox. For instance

ln -s /path/to/git/repo/name_of_repo /path/to/folder/in/dropbox/name_of_repo

Since your repository already contains a .bashrc file all the notebooks in your repository will also work for your non-git collaborator because the GitSetup function will look for such file the momement it realizes that the user does not have git.

Edit: For those who have been following the edits to the init.m file, I have included the GitSetup function inside a package so that the names in the Global context does not get polluted when you start Mathematica.


If you're already using Workbench, I don't see any reason to switch to Eclipse+plug-in. CVS is included in Workbench, and you can still add additional plug-ins as needed.

Likewise, if you're already using Eclipse for non-Mathematica work, I'd just install the Workbench plugin.

As far as I'm concerned, the main difference is the icon. (There are of course other differences, but mostly they don't affect my use of Workbench.)

  • 1
    $\begingroup$ Sometimes a different version of Eclipse than the one packaged with Workbench is required. $\endgroup$ Commented Jan 2, 2014 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.