ctags error with mac
Asked Answered
G

2

13

I have exuberant tags in my mac. Since, yesterday i am getting this error ctags: illegal option -- R usage: ctags [-BFadtuwvx] [-f tagsfile] file ...

I have followed the steps mentoned in this After following the steps mentioned here i can run ctags -R from command line(iterm) But when i execute the same command from a .sh (i have a shell script where i run the cscope and ctags command using it) file i get the above error again but not when i run ctags -R from iterm directly.

Any pointers on solving this issue will be really helpfull. Thanks in advance

Gelinas answered 30/4, 2018 at 7:10 Comment(2)
okay so, i have been able to execute the correct ctags. It seems that /usr/bin/ctags is always getting executed inplace of /usr/local/bin/ctags. I did set alias ctags='/usr/local/bin/ctags' inside my bash_profile. So, now when i run ctags from command line there is no error, but when i execute which ctags it still shows /usr/bin/ctags and when i run ctags -R from a shell script it is still executing /usr/bin/ctagsGelinas
brew link ctags could probably fix your problemPants
G
14

So, the above issue seems to be fixed. The issue being that inside the ~/.bash_profile PATH variable should be set correctly. Even though my PATH variable was pointing to /usr/local/bin but /usr/bin appeared ahead of /usr/local/bin , hence somehow the ctags (when run from shell script) was picking up /usr/bin and not /usr/local/bin (which i have set alias to). Just move /usr/local/bin ahead of /usr/bin and it worked fine.

Solution Type this in terminal: export PATH="/usr/local/bin:/usr/bin:$PATH"

Gelinas answered 2/5, 2018 at 14:15 Comment(0)
D
5

Along with Neil answer you can simply add alias ctags='/usr/local/bin/ctags' to your .bashrc file.

Drone answered 28/9, 2019 at 19:9 Comment(1)
And brew info ctags shows the path of brew intalled ctagsRaguelragweed

© 2022 - 2024 — McMap. All rights reserved.