which ctags shows /usr/local/bin/ctags but when I run ctags it runs /usr/bin/ctags. How is this possible? - bash

Please see output from my terminal session
sharpair:~$ /usr/bin/ctags
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
sharpair:~$ /usr/local/bin/ctags
ctags: No files specified. Try "ctags --help".
sharpair:~$ which ctags
/usr/local/bin/ctags
sharpair:~$ ctags
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
sharpair:~$
Notice when I run ctags without absolute path, the output is the same as if I ran /usr/bin/ctags. However which ctags finds /usr/local/bin/ctags which is the right version I would expect when I run ctags without absolute path.
I have no aliases defined. How do I troubleshoot this? Thanks!

bash has cached the location of ctags.
hash -d ctags
See help hash for details.

Related

Building FMINUIT from source for Octave

I'm trying to install a package called fminuit http://www.fis.unipr.it/~giuseppe.allodi/Fminuit/Fminuit_building.html
on ubuntu 18.04 machine using Octave. The installation step "make -f Makefile.f2c_lnx.Octave" gives me the following error
WrapIO_Matlab.c:4:10: fatal error: mex.h: No such file or directory
Any idea how to remedy this,
cheers, Damir
The build instructions provided by FMINUIT ask you to manually adapt the Makefile to your setup. I'm guessing you did one of those steps incorrectly. I'm running Octave 6.0.0 (current development sources) and worked fine:
$ wget http://www.fis.unipr.it/~giuseppe.allodi/Fminuit/fminuit-src.tar.gz
$ tar xzf fminuit-src.tar.gz
$ cd fminuit-2011.05.31/fminuit/
# modify Makefile.f2c_lnx.Octave
$ make -f Makefile.f2c_lnx.Octave
$ make -f Makefile.f2c_lnx.Octave install
The tricky part is knowing what to modify on the Makefile. For my case, these were the lines (you need to know the exact Octave version and where you installed it):
#Octave prefix directory (typically /usr or /usr/local): modify if needed
-PREFIX=/usr
+PREFIX=/usr/local
#major version number
-OCTAVE_MAJOR=2
+OCTAVE_MAJOR=6
#minor-release version number
-OCTAVE_MINOR=9.12
+OCTAVE_MINOR=0.0
OBJS= mnintr_wrkrnd.o intrac.o WrapIO_Matlab.o doflush.o
MINUIT=Minuit_.o
INSTDIR=../bin/linux_$(ARCH)/octave$(OCTAVE_MAJOR)
The fminuit Makefile will "install" inside the fminuit source directory. You may also want to adjust its INSTDIR value. You need to adjust your Octave path to use it:
>> addpath('/wherever/you/build/fmunuit/fminuit-2011.05.31/bin/linux_x86_64/octave6')
>> fminuit # you probably can figure out how to call this function
error: fminuit: Too few input arguments

ctags error with mac

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
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"
Along with Neil answer you can simply add alias ctags='/usr/local/bin/ctags' to your .bashrc file.

ctags error "format error in tags file"

I work on c code base in Linux. I use perforce as source code repository. I had been using ctags and it was working fine. But recently when press ctrl ] in some symbol then I get below error. I removed tags file and recreated the tags file but the problem didn't solve. Any idea on how to resolve this issue?
E431: Format error in tags file "tags"
Before byte 53035586
If you are just using the ctags -R then try specifying the c language in the command like below. I had the same problem and when I specified the c language while generating the tags, the problem got resolved.
ctags -R --languages=C
There may be tags with large names in your repo. If you can live without those included in your ctags file, you can avoid this error and use rest of the ctags.
To avoid the files/folders, use this syntax
**ctags -R -V --exclude=#/path/to/ctags_ignore_file ./ **
ctags_ignore_file has the list of Folders to be excluded. You can use wildcard entries too.
This solved my problem.
TLDR; add export CSCOPE_EDITOR=vim to ~/.bashrc and close your terminal window.
In my case, setting vim as the default editor for cscope fixed the issue:
echo "export CSCOPE_EDITOR=vim" >> ~/.bashrc # Append to .bashrc
source ~/.bashrc # Load .bashrc into the current shell
After this, you may also use the following commands in your project directory for a quick reconfiguration of cscope and ctags:
ctags -R
cscope -R

inkscape command line, where is it on mac?

This is a kinda silly question. I've installed Inkscape on my mac (Marvericks OS) following this page http://www.inkscape.org/en/download/mac-os/
I know there is a command line option with inkscape. I tried to type inkscape on Terminal and there is no such command. I'm confused... Does this mean that I need to install the linux version of inkscape in order to use the command line?
I have Inkscape installed in /Applications and running this from a terminal does the trick:
/Applications/Inkscape.app/Contents/MacOS/inkscape --help
Usage: inkscape-bin [OPTIONS...] [FILE...]
Available options:
-V, --version Print the Inkscape version number
... etc.
For ease of use symlink it to /usr/local/bin i.e.:
ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape \
/usr/local/bin/inkscape
In general, on MacOS Inkscape needs to be called with an absolute path, and all files given as arguments should also be full paths. See also:
https://bugs.launchpad.net/inkscape/+bug/1449251
As of 2020, the executable on MacOS is now located at
/Applications/Inkscape.app/Contents/MacOS/inkscape
You can symlink it with:
ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape \
/usr/local/bin/inkscape
More info about command line usage here.
I think some paths and filenames have changed over time and today you should add a symlink in /usr/local/bin to point to the bin directory of inkscape:
sudo ln -s /Applications/Inkscape.app/Contents/Resources/bin/inkscape /usr/local/bin/inkscape
Full credit to #Scott above who has this correct "answer" showing as a comment. This solution allows other subcommands of inkscape to work correctly, whereas creating an alias does not.

Ubuntu: ctags error: “ctags: Unknown option: -p”

I am trying to create tags using ctags and getting the error
ctags: Unknown option: -p
There is a similar question asked before. But i could not understand that solution. I'm very sorry for posting the same question again.
I am trying to generate tags for C and C++ files.
OS: ubuntu 10.04LTS
ctags version : 5.8 (Exuberant ctags)
$which ctags : /usr/bin/ctags
There is a .ctags conf file in my home directory, but it is empty.
I tried to generate the tags using the below command
ctags -append=yes -R /home/jabez/mycodedir
I am using the "-append" option because i want to append the tags generated from other directories to the same tags file.
Installation procedure i followed:
./configure --disable-etags
make
make install
Please help me how i can fix the problem.
The problem is that you use -append with a single dash, it should be a double dash: --append.
With single dash, the argument is parsed as a series of one-letter arguments: -a -p -p -e -n -d.

Resources