Open source software giant Red Hat made $2 billion last year. That's not bad for a company whose flagship product is freely and legally available to download from the web.

Sure, the company charges for the Red Hat Enterprise Linux operating system. But because the product is open source, meaning that anyone is free to modify and share the underlying code, multiple alternatives based on the exact same software that Red Hat sells are readily available. What the company's customers are really paying for isn't a copy of the software, which they can get elsewhere for free, but for the support they need to use it.

That business model has worked well for Red Hat, which became a billion-dollar company in 2012, and its success has inspired many entrepreneurs and venture capitalists to invest in products based on open source code in recent years. But despite hundreds of millions of dollars in venture capital flowing into the coffers of startups that sell products based on open source code, many open source developers have struggled to find ways to actually make money from their work.

Many open source developers have struggled to find ways to actually make money from their work.

Quinn Slack thinks his team at a startup called Sourcegraph may have found a solution. Sourcegraph has released its code search-and-collaboration tool under a license called Fair Source. The Fair Source license is similar to open source licenses except for one thing: it includes a provision that says that any company that has more than 15 employees using the software must pay for it. At the same time, the code is still freely available to everyone, regardless of whether they've paid or not. You can still make changes to the software and even publish your own custom versions of it. But users of your modified version, if they hit that 15-employee threshold, will have to pay Sourcegraph too.

In the open source world, the idea of paying for code may sound like heresy. But the Fair Source model is one way developers are trying to strike a balance between getting paid and preserving the core values of open source. While the Fair Source license is unlikely to satisfy the most hardcore open source advocates, developers who may otherwise have simply decided to release a closed source product can use it to share their code with the world.

"It's better to be 90 percent open than 10 percent open," Slack says. Or not open at all.

Someone Has to Pay

Fretting over business models for open source software may feel a little odd when companies like Google, Facebook and Microsoft seem to be publishing new open source tools week after week. But while those companies release software that helps them create their products, they don't typically open source their core products themselves. Google open sourced Kubernetes, which helps it juggle data between thousands upon thousands of servers, but didn't open source its search engine. Facebook open sourced its old database Cassandra, but it hasn't released the algorithms it uses to filter your timeline. Microsoft released the artificial intelligence framework it uses to understand voice commands in Cortana, but it didn't open source Cortana itself, let alone Windows.

Developers of open source software that doesn't originate at a big tech company have had to find other ways to make their projects pay for themselves. Some, like Red Hat, sell support or custom development services. Others, like Alfresco, use open source software to create closed source products that have extra features. A few, like Automattic, sell web-based versions of their software so that companies don't have to worry about managing their own servers. Still others rely on donations, and many rely on some combination of different business models.

Countless open source projects are maintained by volunteers who aren't on anyone's payroll at all.

Investors have poured hundreds of millions of dollars into open source startups—Cloudera alone has raised over a $1 billion. But we're still waiting to see another Red Hat style success story, even as the open source casualties begin to pile up. VA Linux, which sold computers with Linux preloaded, went public in 1999 just four months after Red Hat. Its stock cratered in 2000 and the company refocused on its media and e-commerce acquisitions. All of its assets have now been sold off to other companies. Hortonworks, one of the few other publicly traded open source companies, has yet to turn a profit. Last October RoboVM, which sells tools for mobile app developers, dropped its open source product, complaining that too many companies were using it without paying or contributing back to its development. Days later the startup Famous stopped developing its core product, an open source web development framework, and refocused the company on a web-based marketing product. More recently, a company called ThinkUp, which makes an open source social media analytics tool, announced that it's seeking a buyer because its hosted service wasn't earning enough money to pay for continued development.

Meanwhile, countless open source projects are maintained by volunteers who aren't on anyone's payroll at all. When project maintainers can work on projects only in their spare time, critical bugs, such as the well-publicized "Heartbleed" security flaw, can slip through the cracks. Non-profit organizations like the Linux Foundation have stepped in to help fund a growing number of projects in recent years. For example, the Linux Foundation started the Core Infrastructure Initiative to help fund OpenSSL and other crucial but obscure open source projects. But these sorts of initiatives work best as a way to fund open source projects that a large number of big companies rely on. Important projects can still fall by the wayside.

Code Into Cash

The obvious answer, from a business perspective at least, would be to follow Microsoft, Google, and Oracle's lead and simply not release your core product as open source. But that's a difficult proposition these days, especially for products that are aimed at developers.

"It's not the way developers like to build software, they don't trust it as much," says Slack, who contributed to open source projects such as OpenSSL before starting Sourcegraph.

And the idea of building a closed source product based on open source software—a so-called "open core" product—didn't make sense to him either. "It seems to pit us versus the customers," he says. "It was always 'what do we withhold from our customers.'"

Simply selling support is always an option, but an ideal product is so easy to use that it doesn't need much support. So Slack and company finally hit on the idea of just adding a provision to their license, which was drawn up by open source legal expert Heather Meeker, to simply require companies to pay.

The idea varies from licenses such as Microsoft's non-commercial license in that smaller companies or individuals can still use the software to make money, and from "source available" products such as those from Atlassian in that you don't need to buy the software before you get access to the code. While Slack doesn't like to call it an honor system, since the license is legally binding, that's essentially what it is: a company that uses the code for commercial purposes is responsible for getting in touch and cutting the required checks. There are no registration codes or other technical restraints to force compliance.

A small but growing number of companies including the data management software company Data Duck, programming tool company Codenvy and the code collaboration tool company GitLab have adopted similar licenses. DataDuck founder Jeff Pickhardt says that companies are good about paying. "No one wants to be the person who got their company in trouble," he says.

The main downside is that the Fair Source license is incompatible with open source licenses, which means Sourcegraph's code can't be mixed into other software. But given that the alternative would likely be not offering the code at all, Slack thinks it's a worthwhile tradeoff. Brad Micklea, the COO of Codenvy, agrees. The company released the source code for its Codenvy Team product under a modified version of the Fair Source license earlier this year. "Our downloads tripled after we adopted it," he says.

The Fair Source license clearly isn't going to solve every open source project's money woes. But for many developers, it could be an important new way to turn code into cash.