ctags is a free, open source frameworks & platforms project written in C and released under GPL-2.0. It has 7,296 GitHub stars, 671 forks and 269 open issues, and was last pushed 4 days ago. On this registry it ranks #56 of 122 tracked projects in Frameworks & Platforms, with 5 head-to-head comparisons available.

What is ctags?

Universal Ctags is a maintained implementation of ctags that generates an index, or tag file, of the language objects found in source files, and it is aimed at developers and at the authors of text editors and other tools that need to locate those indexed items across many programming languages.

What it is

Universal Ctags, abbreviated as u-ctags, is a maintained implementation of ctags written in C and licensed under GPL-2.0. The program scans source files and generates an index, or tag file, of the language objects it finds for the programming languages it supports. That index is what makes it easy for text editors and other tools to locate the indexed items, which is why the project lives in the code navigation, code reading and code completion ecosystem rather than in any single language toolchain. It is a continuation rather than a new invention: Exuberant Ctags (e-ctags), maintained by Darren Hiebert, is its direct ancestor.

The concrete problem it solves is the one left behind by its predecessor. Exuberant Ctags improved traditional ctags with multi-language support, with the ability for the user to define new languages searched by regular expressions, called optlib in Universal Ctags, and with the ability to generate emacs-style TAGS files, but the activity of that project unfortunately stalled. Universal Ctags has the objective of continuing the development of Exuberant Ctags. It began as a personal fork of Exuberant Ctags on GitHub created by Reza Jelveh, and as interest and participation grew it was decided to move development to a dedicated project with the goal of maintaining a common and unified working space where people interested in making ctags better can work together. In other words, it replaces Exuberant Ctags for anyone who still depends on that tool.

Key capabilities

  • Generates a tag file of language objects that editors and other tools use to jump to indexed items, including emacs-style TAGS output.
  • Fully extended optlib, a feature to define a new language parser from a command line using regular expressions.
  • A new extended C/C++ language parser, distinct from the parser inherited from the ancestor project.
  • More improved language support than earlier implementations, reflecting the project's goal of broader multi-language coverage.
  • An experimental interactive mode.
  • Daily Windows builds published as zip packages by the ctags-win32 project.
  • Nightly Unix-like builds published as tarball archives by the ctags-nightly-build project.

Who uses it and how

  • Editor and tool integrators use the generated tag file for code navigation, tagjumping, code reading and code summarization inside their own software.
  • Mac users install recent builds through the universal-ctags Homebrew formula.
  • Windows users download daily zip packages from the ctags-win32 releases page instead of building the source themselves.
  • Unix-like users take nightly tarball archives from the ctags-nightly-build releases page.
  • Snap packagers clone the ctags-snap repository and follow its instructions; Snapcraft then fetches the source code from GitHub automatically.

Getting started

The primary path is to build from source with Autotools on GNU/Linux, OSX or Windows 10 WSL: git clone https://github.com/universal-ctags/ctags.git, then ./autogen.sh, ./configure, make and make install, with --prefix= used to override the installation directory that otherwise defaults to /usr/local and with GNU make assumed as the make command. Platform-specific notes live in docs/autotools.rst, docs/windows.rst and docs/osx.rst.

How it compares

Among the implementations named in the project's own documentation, Universal Ctags positions itself against two ancestors: traditional ctags and Exuberant Ctags. Exuberant Ctags added multi-language support, optlib-style user-defined languages and emacs-style TAGS output before its activity stalled, and Universal Ctags takes over that development rather than starting from a blank slate.

When to use it — and when not to

Anyone self-hosting it should expect to build from source on GNU/Linux, OSX or Windows 10 WSL through Autotools, since the documented alternatives are limited to the Homebrew formula, the ctags-win32 daily packages, the ctags-nightly-build tarballs and the ctags-snap snap recipe. Teams that want a turnkey or managed service, or that are unwilling to depend on a GPL-2.0 binary they compile themselves, should look elsewhere. Note also that interactive mode is explicitly described as experimental, so it should not be treated as a stable interface.

project readme (upstream, from github) — read inline

Universal Ctags

Coverity Scan Build Status Coverage Status Build status RTD build status CircleCI Build Status GitHub Actions/VALGRIND Gurubase

Universal Ctags (abbreviated as u-ctags) is a maintained implementation of ctags. ctags generates an index (or tag) file of language objects found in source files for programming languages. This index makes it easy for text editors and other tools to locate the indexed items.

Exuberant Ctags (e-ctags) maintained by Darren Hiebert, the ancestor of Universal Ctags, improved traditional ctags with multi-language support, the ability for the user to define new languages searched by regular expressions (called optlib in Universal Ctags), and the ability to generate emacs-style TAGS files. But the activity of the project unfortunately stalled.

Universal Ctags has the objective of continuing the development of Exuberant Ctags. Reza Jelveh initially created a personal fork of Exuberant Ctags on GitHub. As interest and participation grew, it was decided to move development to a dedicated project as Universal Ctags. The goal of this project is to maintain a common/unified working space where people interested in making ctags better can work together.

Some of the major features of Universal Ctags are:

  • more numbers of improved language support
    • new extended C/C++ language parser, etc.
  • fully extended optlib (a feature to define a new language parser from a command line)
  • interactive mode (experimental)

The latest build and package

If you want to try the latest Universal Ctags without building it yourself...

Windows

Daily builds are available at the ctags-win32 project. Go to the releases page to download zip packages.

Unix-like

Nightly builds are available at the ctags-nightly-build project. Go to the releases page to download tarball archives.

Mac

Recent builds are available via the universal-ctags Homebrew formula.

Snap

Go to ctags-snap and clone the ctags-snap repo. Then, follow instructions to build the snap package of Universal Ctags. Snapcraft will automatically fetch the source code from GitHub.

How to build and install

To build with Autotools (Autoconf and Automake) on GNU/Linux, OSX, or Windows 10 WSL,

    $ git clone https://github.com/universal-ctags/ctags.git
    $ cd ctags
    $ ./autogen.sh
    $ ./configure  # use --prefix=/where/you/want to override installation directory, defaults to /usr/local
    $ make
    $ make install # may require extra privileges depending on where to install

GNU make is assumed as the make command.

See docs/autotools.rst for more information.

To build on Windows, see docs/windows.rst for more information.

To build on OSX, see docs/osx.rst for more information.

Manual

The primary documents of Universal Ctags are man pages. Users should first consult the ctags(1), and other man pages if necessary.

Universal Ctags Hacking Guide, which also includes the man pages, is primarily for developers and provides additional information to the man pages, including experimental features.

See also */README.md on this repository.

Differences from exuberant-ctags

You may be interested in how Universal Ctags is different from Exuberant Ctags. See ctags-incompatibilities(7) and Introduced changes for details.

The most significant incompatible changes:

  • Universal Ctags doesn't load ~/.ctags and ./.ctags at starting up time. Instead, it loads ~/.ctags.d/*.ctags and ./.ctags.d/*.ctags.

  • Universal Ctags is more strict about characters that can be used in kind letters and kind names than Exuberant-ctags.

    • The letter must be an alphabetical character ([a-zA-EG-Z]). F is reserved for file kind.

    • The first character of the name must be alphabetic, and the rest characters must be alphanumeric ([a-zA-Z][a-zA-Z0-9]*).

    The detailed background is explained in #1737.

    If you want to reuse your .ctags written for Exuberant-ctags, you must review kind letters and names defined with --regex-=... options. When updating the definitions, using --kinddef-=... option is appreciated.

CVE-2022-4515

It is not affected to Universal Ctags. It was fixed in e00c55d7a0204dc1d0ae316141323959e1e16162 in 2016. Thanks to the reporter.

Pull-requests are welcome!

Frequently asked questions

Is ctags free to use?

ctags is open source under the GPL-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does ctags do?

A maintained ctags implementation

What is ctags written in?

ctags is primarily written in C. Its source is publicly available at https://github.com/universal-ctags/ctags, and it has 7,296 GitHub stars.