Skip to content

Instantly share code, notes, and snippets.

@carakan
Forked from alexshagov/install-universal-ctags-with-gtags-osx.md
Last active April 1, 2024 10:22
Show Gist options
  • Save carakan/60496e0f05033417be2352419639fcc5 to your computer and use it in GitHub Desktop.
Save carakan/60496e0f05033417be2352419639fcc5 to your computer and use it in GitHub Desktop.
How to install GNU Global with universall ctags support on mac OS

Unfortunately, homebrew does not support --with-universal-ctags option for global (on the state of April 2018) The reason is that universal-ctags is not officially released yet.

Install universal ctags

Run brew install --HEAD universal-ctags/universal-ctags/universal-ctags (See https://github.com/universal-ctags/homebrew-universal-ctags repo)

If you're on macOS, you might have an old ctags installed with command line tools for XCode. To fix this, simply run alias ctags="`brew --prefix`/bin/ctags"

To check that universal-ctags installed correctly, run the ctags --version command. You must see the following output:

Universal Ctags 0.0.0(8e09804), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Apr  8 2018, 10:06:38
  URL: https://ctags.io/

Install GNU Global from source

Download GNU Global from https://www.gnu.org/software/global/download.html Uncompress and configure it with universal ctags

./configure --with-universal-ctags=/usr/local/bin/ctags and then make & sudo make install

To check that gtags was installed correctly, you could run which gtags. It must point out to /usr/local/bin/gtags

Now, running the gtags --gtagslabel=new-ctags should not produce any errors!

@SurpassAll
Copy link

cool !!!

@bigfish
Copy link

bigfish commented Dec 8, 2019

Thanks !

@UtaAmb
Copy link

UtaAmb commented Jan 23, 2020

🙇‍♂️

@gstokkink
Copy link

Thanks!

@afidegnum
Copy link

gtags --gtagslabel=new-ctags
/usr/local/bin/ctags: unrecognized option '--langmap=Ada:.adb.ads.Ada,Ant:(build.xml)(*.build.xml).ant.xml,Asm:.A51(*.29[kK])(*.[68][68][kKsSxX])(*.[xX][68][68]).asm.ASM.s.S,Asp:.asp.asa,Autoconf:(configure.in).ac,Automake:(Makefile.am).am,Awk:.awk.gawk.mawk,Basic:.bas.bi.bb.pb,BETA:.bet,Clojure:.clj.cljs.cljc,C:.c,C++:.c++.cc.cp.cpp.cxx.h.h++.hh.hp.hpp.hxx.inl,CSS:.css,C#:.cs,ctags:.ctags,Cobol:.cbl.cob.CBL.COB,CUDA:.cu.cuh,D:.d.di,Diff:.diff.patch,DTD:.dtd.mod,DTS:.dts.dtsi,DosBatch:.bat.cmd,Eiffel:.e,elm:.elm,Erlang:.erl.ERL.hrl.HRL,Falcon:.fal.ftd,Flex:.as.mxml,Fortran:.f.for.ftn.f77.f90.f95.f03.f08.f15,gdbinit:(.gdbinit).gdb,Go:.go,HTML:.htm.html,Iniconf:.ini.conf,ITcl:.itcl,Java:.java,JavaProperties:.properties,JavaScript:.js.jsx,JSON:.json,LdScript:(*.lds.S)(ld.*).lds.scr.ld,Lisp:.cl.clisp.el.l.lisp.lsp,Lua:.lua,M4:.m4.spt,man:.1.2.3.4.5.6.7.8.9,Make:([Mm]akefile)(GNUmakefile).mak.mk,MatLab:.m,Myrddin:.myr,ObjectiveC:.mm,OCaml:.ml.mli.aug,passwd:(passwd),Pascal:.p.pas,Perl:.pl.pm.ph.plx.perl,Perl6:.p6.pm6.pl6,PHP:.php.php3.php4.php5.php7.phtml,pod:.pod,Protobuf:.proto,puppetManifest:.pp,Python:.py.pyx.pxd.pxi.scons,QemuHX:.hx,R:.r.R.q,REXX:.rexx.rx,Robot:.robot,RpmSpec:.spec,reStructuredText:.rest.reST.rst,Ruby:.rb.ruby,Rust:.rs,Scheme:.SCM.SM.sch.scheme.scm.sm,Sh:.sh.SH.bsh.bash.ksh.zsh.ash,SLang:.sl,SML:.sml.sig,SQL:.sql,SystemdUnit:.unit.service.socket.device.mount.automount.swap.target.path.timer.snapshot.scope.slice.time,Tcl:.tcl.tk.wish.exp,Tex:.tex,TTCN:.ttcn.ttcn3,Vera:.vr.vri.vrh,Verilog:.v,SystemVerilog:.sv.svh.svi,VHDL:.vhdl.vhd,Vim:(vimrc)([._]vimrc)(gvimrc)([._]gvimrc).vim.vba,WindRes:.rc,YACC:.y,YumRepo:.repo,Zephir:.zep,Glade:.glade,Maven2:(pom.xml).pom,PlistXML:.plist,RelaxNG:.rng,SVG:.svg,XSLT:.xsl.xslt'
        Try '/usr/local/bin/ctags --help' for a complete list of options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment