Skip to content

Guide · Open source

How to use Infer: install, run it on code and read results

Updated · written with AI from the project's own documentation and checked against our catalogue data

Infer is an open-source static analysis tool. It reads your source code and looks for likely bugs without running the program. It supports Java, C, C++, and Objective-C, and it is written in OCaml. This guide explains what Infer is, how to get it set up from the project's documentation, and what to check before you rely on it, so you can decide whether it fits your codebase.

Infermeta/infer · ★ 15.7k · MIT

Quick start

  1. 1Confirm your language. Check that your project is written in Java, C, C++, or Objective-C, the four languages the README names.
  2. 2Open the Getting Started page. Go to fbinfer.com/docs/getting-started, which the README links for packaged installs.
  3. 3Install a packaged release. Follow the packaged install steps for your operating system from that page.
  4. 4Check the licence for Java. If you need Java support, read the GPL licensing note in the README and confirm the components are acceptable for your project.
  5. 5Build from source if needed. If packaged installs do not work for you, follow INSTALL.md in the repository to build Infer from source.
  6. 6Add it to review. Run Infer as part of your code review workflow so likely bugs are reviewed before code merges.

What does Infer do?

Infer is a static analysis tool, which means it reads source code and looks for likely bugs without executing the program. Developers use it to catch problems in code before it ships.

It supports Java, C, C++, and Objective-C. The project's README names only these four languages, so projects in other languages are outside what it documents.

Install Infer from a packaged release

The project's README directs users to its Getting Started page at fbinfer.com/docs/getting-started for details on installing packaged versions of Infer. Use that page for the current installation steps, since the packaged installs are the route the README points to first.

The README also lists a source build, described in the project's INSTALL.md file. Choose a source build only if you are comfortable compiling software yourself. The README lists no prerequisites for the packaged route.

  • Open the Getting Started page on the Infer website and follow the packaged install for your system.
  • If packaged versions do not suit you, read INSTALL.md in the repository for building from source.
  • To get the source code, the README gives this command: git clone https://github.com/meta/infer
git clone https://github.com/meta/infer

Enable Java support and check the licence

Infer is MIT-licensed. The README adds a caveat: enabling Java support may require you to download and install components licensed under the GPL.

Before you enable Java analysis in a company or commercial project, read the licensing terms of those components yourself. The README does not spell out what they require, so this guide does not make a claim about it.

Add Infer to your code review process

Teams who want an automated bug check as part of code review are the intended audience. Running Infer as a step alongside review lets bugs surface before code merges, instead of after release.

Infer is a command-line developer tool. It has no graphical interface according to the README, so plan to run it from a terminal or a build script.

  • Run Infer on a Java, C, C++, or Objective-C codebase.
  • Review the likely bugs it reports before merging.
  • Decide with your team which findings must be fixed and which can be accepted.

Who should and should not use Infer

Infer suits developers on Java, C, C++, or Objective-C code who are comfortable installing a command-line tool from a packaged release.

It is not a fit for beginners who want a point-and-click tool, or for projects in languages outside the four it supports.

What people use it for

  • Catching likely bugs in a Java codebase before a release
  • Running an automated bug check on C or C++ code during code review
  • Scanning Objective-C code for problems without executing the app
  • Adding a static analysis step to a team's review process

Frequently asked questions

Is Infer free to use?

Infer is MIT-licensed, according to its README. Enabling Java support may require components licensed under the GPL, so check those terms before using Java analysis in a commercial project.

What languages does Infer support?

The README says Infer supports Java, C, C++, and Objective-C. It is written in OCaml. Projects in other languages are not covered by the README.

How do I install Infer?

The README points to the Getting Started page at fbinfer.com/docs/getting-started for packaged installs. To build from source, follow INSTALL.md in the repository.

Does Infer have a graphical interface?

The README does not describe a graphical interface, and the project points users to packaged installs and source builds. Plan to use Infer from the command line.

Does Infer run my program?

No. Infer is a static analysis tool, so it reads source code and looks for likely bugs without executing the program.

What are alternatives to Infer?

This directory lists no comparable projects for Infer, so it cannot make a comparison here. Compare it against other static analyzers for your language before choosing.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Infer is a good fit if you work in Java, C, C++, or Objective-C, are comfortable with a command-line tool, and want an automated bug check in code review. Pick something else if you want a graphical tool, or if your project uses a language outside those four.

Install options & downloads