Exuberant Ctags on Mac

30,296

Solution 1

Install MacPorts, then do:

port install ctags

Solution 2

Install Homebrew, then do:

brew install ctags

Solution 3

For a more friendly way to do this instead of using mac-ports or homebrew and running the risk of causing errors download ctags from here and compile with xcode (starting with version 4.3 command line tools are not installed by default but rather through Preferences -> Downloads) then simply move the compiled ctags to /usr/bin/ctags-exuberant to preserve the original.

Commands Used:

Change Directory to Downloads and ctags directory:

$cd
$cd Down<tab>ctags<tab>

Configure:

$./configure

Make:

$make

Move to /usr/bin:

$sudo mv ctags /usr/bin/ctags-exuberant



NOTE: <tab> is equal to pressing the tab key.
NOTE: XCode can now be downloaded from the Apple App Store!

Very useful for getting Tagbar for vim to work! Tagbar is available here.

Share:
30,296
Presnus
Author by

Presnus

Updated on July 09, 2022

Comments

  • Presnus
    Presnus almost 2 years

    I'm currently using vim for my PHP development. A few weeks ago I bought myself a mac, and wanted to re-generate my tags for a new Zend Framework version.

    I used the following script in the past (linux machine) to generate the tags:

    #!/bin/bash
    cd ~/www/ZF/     
    ctags-exuberant -f ~/.vim/tags/zend \
    -h ".php" -R \
    --exclude="\.svn" \
    --totals=yes \
    --tag-relative=yes \
    --PHP-kinds=+cf \
    --regex-PHP='/abstract class ([^ ]*)/\1/c/' \
    --regex-PHP='/interface ([^ ]*)/\1/c/' \
    --regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'
    

    You can see I used the "ctags-exuberant" command. The problem is that this isn't found on my system (mac). I only have the ctags command. I tried installing the newest version of the ctags library (http://ctags.sourceforge.net/) but didn't gave me that command.

    The ctags command does not have the same parameters as the ctags-exuberant. So 2 questions:

    • What's the difference between the 2 commands?
    • How can I install ctags-exuberant or use the normal ctags command for PHP?

    Thanks! Ward

  • romainl
    romainl almost 13 years
    Mac OS X's default ctags is the basic ctags, Exuberant ctags is an improvement over ctags.
  • Yinda Yin
    Yinda Yin over 12 years
    Sorry, Daniel, but we don't moderate for technical accuracy. How about I give you an upvote instead?
  • James McMahon
    James McMahon over 11 years
    Looks like it is just ctags now. For Mac Os 10.8 (Mountain Lion) beware because GNU ctags is already on the path (this might have come out of the box or with XCode). You will have to make sure your brew path has a higher precedence then /usr/bin.
  • Excalibur
    Excalibur over 11 years
    @JamesMcMahon How should one go about doing that? (I'm a recent convert from Linux to MacOS, so I'm still figuring out things like Homebrew)
  • expelledboy
    expelledboy about 11 years
    @Excalibur echo "/usr/local/bin/\n$(cat /etc/paths)" | sudo tee -a /etc/paths
  • gitaarik
    gitaarik about 11 years
    or just edit /etc/paths as superuser and specify the correct order. brew also warns you about this when you run 'brew doctor'
  • romainl
    romainl about 11 years
    people, we are supposed to downvote innaccurate or misleading answers, not perfectly valid answers that happen to not use our prefered tool.
  • Edward Falk
    Edward Falk over 10 years
    Since I already have my Mac configured with xcode, and I don't have macports or homebrew installed, this was the best solution for me.
  • masukomi
    masukomi over 6 years
    it's not about preferred tool @romaini . the question was asking about exuberant ctags, not ctags. they are different things.
  • romainl
    romainl over 6 years
    @masukomi, the "ctags" you get via MacPorts is "exuberant ctags".
  • masukomi
    masukomi over 6 years
    doh! my apologies @romaini
  • JS.
    JS. over 6 years
    Make sure to download the ctags tar.gz file, NOT the .zip file. Sourceforge may give you the '.zip' file, which does not contain the ./configure file you need for this. You may have to dig around a bit on the Sourceforge site to find the tar.gz file.
  • motobói
    motobói almost 5 years
    This will install plain catas, now exuberant-ctags
  • Xxxo
    Xxxo about 3 years
    Thank you for the solution! The brew and macports solutions are starting to get annoying. Some people do not want to install viruses for doing something simple.
  • Ștefan
    Ștefan almost 2 years
    As @JamesMcMahon Mac OS users should be aware of the installation path. One can fix the path by these simple steps: gist.github.com/nazgob/1570678