How do I use GPL and MIT licenses correctly?

I should prefix this with: I am not a copyright lawyer. If you're really concerned about something, contact one. People at the FSF might be able to help you.


You should include the full text of the license. Even if you just stick it in a LICENSE file at the root of the project. I don't think anything immediately bad would happen if you didn't but in the long term (which copyright is), not having a solid reference to your license could be a bad thing.

Being explicit doesn't cost very much time.

Edit: actually the WARRANTY section might be worth including for your protection, whichever license you choose. I have no evidence to say that not including it implies a warranty, but again, be safe, not sorry.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 

A copyright notice (© <date> <name>) isn't legally required in most places anymore but not including it doesn't help anyone. You'd have a harder time proving you owned copyright and it would be a lot harder for people who want to license it under different terms. I would definitely put it in there... But I guess this isn't really an issue with BSD/MIT -style licenses.

As for using a handle or nick, in other medias people have been using pseudonames for centuries. If it came to a legal suit, you'd need to be able to prove you are that person so obviously this might make it a little harder but it's not insurmountable.

If you're going MIT, you have so little legal recourse that these issues will probably never apply to you.


The year in the copyright notice isn't essential but if you wanted to sue somebody in several decades time, you'd have to prove when it was created. Which might be hard. A fixed notice helps you and costs nothing but a few seconds.


We should be clear here.

  • GPL allows commercial redistribution but the source code of the whole thing must be available (with changes) to anyone who purchases a copy of it .
  • LGPL is good for software libraries. These can be included in proprietary projects without needing to redistribute the whole source. The only time source distribution needs to happen is if they edit your code and even then, they only have to release their changes to it.
  • MIT code can be relicensed freely. Somebody could take your code, verbatim, and re-release it under GPL, proprietary licenses, etc.

"GPL vs MIT" is an eternal battle. Go with whatever you're actually happiest with, not what is most convenient. If you're not happy for potentially evil people to take your code and use it for potentially evil or lucrative purposes, use something where you have some recourse like GPL. If you really don't care and you're not using any GPL'd code yourself, a more liberal license like MIT would be fine.

Remember virally-open-source licenses aren't just good for you, they ensure that your work, however it's adapted and re-released is free for everybody under the same terms. Even if you're dumping the code with no interest in maintaining it, GPL gives it a better hope of remaining free.

There's no need to rush it these decisions either but you have to think of the worst possible cases to really know if you're making the right decision. Once it's released under one of these licenses, that's it, it's done.


At the end of the GPLv2 license, there's a guide on how to apply the license terms to your project. The FSF put a lot of effort into writing that document and making it as legally valid as possible, so I'd follow their advice.

If you decide to use the GPL license, please make sure that you include the 'version 2 or later' clause. This will save you headaches later, and make GPLv2 projects compatible with GPLv3 and vice-versa.

Like Oli said, you don't legally need to use your real name or your email in the header of a file to keep your copyright rights, but it's highly recommended to save you and other people from headaches later on.

Deciding between the GPL license and the MIT license is both an ethical and strategic decision, and there are many arguments in favour of either one.

Tags:

License

Gpl