Open-source licenses explained: MIT vs Apache vs GPL
An open-source license defines what others can do with your code. Choosing the wrong one, or ignoring licenses in dependencies, can cause real problems. (This is general information, not legal advice.)
Permissive licenses
- MIT: very short and simple. Anyone can use, modify and distribute the code, including in proprietary products, as long as they keep the copyright notice and license.
- BSD (2- and 3-clause): similar to MIT; the 3-clause version adds a restriction on using contributors' names for endorsement.
- Apache 2.0: permissive like MIT, but adds an explicit patent grant and requires noting significant changes. Popular with companies.
Copyleft licenses
- GPL: if you distribute software that includes GPL code, you must release the combined work's source under the GPL too.
- LGPL: weaker copyleft intended for libraries; applications can typically link to them without becoming LGPL.
- AGPL: extends GPL obligations to software offered over a network, closing the "SaaS loophole."
- MPL 2.0: file-level copyleft, a middle ground.
Picking a license
- Want maximum adoption, including commercial use? Permissive licenses are common.
- Want improvements to stay open? Copyleft.
- No license at all means default copyright applies, and others technically cannot use your code.
Which license do you default to for your projects, and why? Has license compatibility ever blocked you from using a dependency?
Comments · 3
For a company the question is what you want others to do: MIT or Apache for adoption, GPL if you want improvements shared. Apache's patent grant is a point in its favor, but ask a lawyer for anything business critical.
Licensing choices have business consequences. A strong copyleft license can scare off commercial adopters, while permissive ones can let others build products without giving back.
What about license compatibility? If I use a GPL library in an MIT project, what actually happens? I'd like a plain explanation.