I want to share the code of a research project, for academic purposes, in Bitbucket and Matlab's FileExchange.

The code is in both Matlab and Mathematica, and I want to restrict its use for commercial purposes. I don't know if I can use Affero GPL for this, as both Matlab and Mathematica are commercial software.

This is the most direct response from the terms of GPLv3 that I've found:

If a programming language interpreter has a license that is incompatible with the GPL, can I run GPL-covered programs on it? (#InterpreterIncompat)

When the interpreter just interprets a language, the answer is yes. The interpreted program, to the interpreter, is just data; the GPL doesn't restrict what tools you process the program with.

However, when the interpreter is extended to provide “bindings” to other facilities (often, but not necessarily, libraries), the interpreted program is effectively linked to the facilities it uses through these bindings. The JNI or Java Native Interface is an example of such a facility; libraries that are accessed in this way are linked dynamically with the Java programs that call them.

So if these facilities are released under a GPL-incompatible license, the situation is like linking in any other way with a GPL-incompatible library. Which implies that:

  1. If you are writing code and releasing it under the GPL, you can state an explicit exception giving permission to link it with those GPL-incompatible facilities.

  2. If you wrote and released the program under the GPL, and you designed it specifically to work with those facilities, people can take that as an implicit exception permitting them to link it with those facilities. But if that is what you intend, it is better to say so explicitly.

  3. You can't take someone else's GPL-covered code and use it that way, or add such exceptions to it. Only the copyright holders of that code can add the exception...

What license is compatible with these requirements in Matlab / Mathematica?

  • Allowing academic usage
  • Requiring attribution for academic usage
  • Restricting commercial usage (the program's output -processed images- should not be sold)
  • Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask – gnat Aug 9 '14 at 15:38
  • 2
    What do you mean by "commercial usage"? Note that open source licenses can't restrict how someone uses the copy they obtained. – Bart van Ingen Schenau Aug 9 '14 at 16:11
  • Please check edits. – andandandand Aug 9 '14 at 16:18
  • This question appears to be off-topic because it is about legal advice – Tulains Córdova Aug 10 '14 at 1:04
  • If you are basing it on existing GPLv3 software, then you are required to release under the same GPLv3 terms. – Jeff-Inventor ChromeOS Aug 10 '14 at 3:59

First off, there is no open source license that allows you to restrict the area it is used in. Thus, the desire to use the GPL or AGPL and also have it restricting commercial usage is completely contrary to the definition of open source.

6. No Discrimination Against Fields of Endeavor

The license must not restrict anyone from making use of the program in a specific field of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research.

Rationale: The major intention of this clause is to prohibit license traps that prevent open source from being used commercially. We want commercial users to join our community, not feel excluded from it.


The code is in both Matlab and Mathematica, and I want to restrict its use for commercial purposes. I don't know if I can use Affero GPL for this, as both Matlab and Mathematica are commercial software.

As both the GPL and AGPL are open source licenses, they are incompatible with the "restrict it to academic use."

At this point, you are left to writing your own license. You may wish to look at How can I create my own software license? and possibly head over to the License Generator which generates a boiler plate license based on various selections that you could then modify.

It should also be pointed out that this license will be incompatible with other open and free software licenses.

| improve this answer | |

There is no open source licence that can do that. What you are describing is:

  • a commercial licence
  • that happens to be free for academic (and personal?) use, but with attribution obligations
  • that includes source code
  • with redistribution rights, which may be of binaries, source and/or modified versions
  • with sub-licensing, to cover redistribution, which may or may not include 'copyleft'.

That's a pretty complicated licence. Are you sure you're up for it?

You might do better to pick a GPL (no exceptions) licence to start with, relying on the general distaste for such licences in the commercial sector. You can add an academic attribution clause quite easily without intruding on the other terms.

Then down the track you can dual licence it with whatever commercial terms you want and/or stop releasing updates for the GPL version. If you plan to do that, you need to keep tight control over the copyright of the original and any modified versions.

| improve this answer | |

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