I am developing a package and would like to be able to test it without having to copy the package file to my $UserBaseDirectory/Applications folder for each change, so it would be convenient for me to just create a Finder link or symlink pointing back to my working file. So far I have not been able to convince Mathematica to treat the link as a package file. Am I missing a subtle technique that may make this possible?

  • 2
    $\begingroup$ For development purposes, I would just add the location of your file's directory to $Path via AppendTo[$Path, directory-with-your-file] - I think that's simpler. $\endgroup$ Commented Apr 18, 2013 at 14:26
  • $\begingroup$ Wolfram Workbench might be handy too $\endgroup$
    – Spawn1701D
    Commented Apr 18, 2013 at 15:36

1 Answer 1


I had the same problem with the addition, that I have several machines (home, work, laptop) where I develop. What I wanted to have was a GetDev which works like the usual Get with the difference that it looks in my development folder for the package when it cannot not be loaded.

Therefore, I'm using the following function GetDev when I want to load my package which is in active development. It consists of two definitions. The first one extracts the dev-folder for the appropriate machine

GetDev::unknMach = 
  "The computer `1` is not known as development machine.";
GetDev[package_String] := 
        GetDev[package, FileNameJoin[{$UserDocumentsDirectory, "workspace"}]], 
        Message[GetDev::unknMach, $MachineName]

Here you can define dev-folders for each machine you have. Then GetDev is called again but with the path to the dev-folder. First it tries to load the package with the normal Get. We suppress the Get::noopen message but use Check to test for it. When the call to Get fails, we append the dev-folder to our $Path and try again.

GetDev[package_String, devpath_String] := 
     (AppendTo[$Path, FileNameJoin[{devpath, 
             StringReplace[package, "`" -> $PathnameSeparator]}]];
        Message[General::noopen, package],

Some important details:

I'm using the usual Wolfram Workbench application structure. So if I develop a package Blub then the code for it is located in mypath/workspace/Blub/Blub. Important are the two nested Blub folders. This is why I'm not simply appending my development folder but instead, I use the package name as folder in this line:

AppendTo[$Path, FileNameJoin[{devpath, StringReplace[package, "`" -> $PathnameSeparator]}]

If you are using only one development machine, then you can define the dev-folder to be fixed. Btw, this is only a hacked version. If I would have to write it again, I would add some details like removing the added path, when the package could not be loaded.


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.