Strange behaviour of Bibliography Completion and Label From Document commands accessed through option-esc. Description of the problem, and workaround based on my correspondence with Charilaos (Harris) Skiadas are below for archival purpose. Thanks Harris!
-- Working system
PowerPC G4, Mac OS X Version 10.4.8, TexMate Version 1.5.4 (1324), TexLive Full Installation (2006/11/07) [Tex (based upon TeX Live)] / MacTeX (10 November 2006)
-- Description of the problem
option-esc results in:
\footcite{sh: line 1: /usr/local/TeXLive/bin/i386-apple-darwin8.6.1/ kpsewhich: cannot execute binary file sh: line 1: /usr/local/teTeX/ bin/i386-apple-darwin8.6.1/kpsewhich: cannot execute binary file cite_key}
\ref{sh: line 1: /usr/local/TeXLive/bin/i386-apple-darwin8.8.1/ kpsewhich: cannot execute binary file sec:section_name}
\ref{sh: line 1: /usr/local/TeXLive/bin/i386-apple-darwin8.8.1/ kpsewhich: cannot execute binary file fig:label_name}
TeXLive and MacTeX installations modify /etc/profile, and set the path as: PATH="$PATH:/usr/local/TeXLive/bin/powerpc-apple-darwin-current", which is actually an alias for /usr/local/TeXLive/bin/powerpc-apple- darwin7.9.0/.
The scripts of both commands use first `which kpsewhich`, and only if that fails, `locate kpsewhich` to find out where kpsewhich lives.
Running the which kpsewhich command in the terminal returns: /usr/local/TeXLive/bin/powerpc-apple-darwin-current/kpsewhich
Running the locate kpsewhich command in the terminal returns: /usr/local/TeXLive/bin/i386-apple-darwin8.8.1/kpsewhich /usr/local/TeXLive/bin/powerpc-apple-darwin7.9.0/kpsewhich /usr/local/TeXLive/man/man1/kpsewhich.1 /usr/local/TeXLive/texmf.texlive/doc/man/man1/kpsewhich.1
The `which kpsewhich' command in both scripts fails -- according to my humble opinion, due to the fact that what is finds is not the actual file but an alias. Then `locate kpsewhich` points to the first kpsewhich it finds on the system, which is an intel binary. Thus it declares "[...] cannot execute binary file". (If you have the Basic Installation of TeXLive, which does not come with intel binaries, it will declare "[...] cannot find binary file".)
-- Workaround
Bibliograpyh Completion, and Label From Document commands are based on the following scripts: LatexCitekeys.rb, and LatexLabelCompletions.rb. Both of them live in /Applications/ TextMate.app/Contents/SharedSupport/Support/bin. Edit both scripts, replacing the following loop -- lines 51-55, and 11-15, respectively:
if `which kpsewhich`.match(/^no kpsewhich/) then kpsewhich = `locate kpsewhich`.split("\n").grep(/kpsewhich$/)[0] else kpsewhich = "kpsewhich" end
with a statement indicating the correct path to the powerpc kpsewhich binary.
kpsewhich = "/usr/local/TeXLive/bin/powerpc-apple-darwin-current/ kpsewhich" or kpsewhich = "/usr/local/TeXLive/bin/powerpc-apple-darwin7.9.0/kpsewhich" should both work.
Check your /etc/profile or better run "echo $PATH" in the terminal to confirm your path.
-- Özgür Gökmen | og@pyromedia.org