TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shell script (which should open some program/file) which I want to invoke by clicking on a link in the generated .pdf file (in my case a beamer presentation).

I tried including:


in the source code. Then, when clicking on the link (when viewing with acrobat reader) it opens the script in a text editor rather then actually running it. I'm using MacTeX on a Mac OS X system.

What am I doing wrong?

share|improve this question
up vote 9 down vote accepted

On MacOS run:... hyperlinks are executed using the open command and, hence, processed by the default application configured for the specific file type. For .sh files this usually is some text editor.

You can change the default application from the finder (click on an .sh file and choose "Get Info"), however, MacOS accepts only "valid applications" (.app compartments) as a target, so the Bash or Tcsh binaries cannot easily be defined as default application :-(

Depending on your case a better solution might be to turn the shell script itself into an app and specify this in your run: link. This is easily possible using a tool like Appify.

share|improve this answer
Worked very nicely! Both from Skim and AReader. One remark though: In the .sh script, the path should be absolute rather then relative - otherwise, the generated .app bundle doesn't work. – Dror Dec 9 '11 at 19:07
I'm having the same problem here. I tried using .command instead of .sh to have the file opened by default by Terminal and it didn't work. I also tried using an applescript saved as a .app to run the shell script without more success. I'm using Adobe Reader by the way. It seems that Adobe Reader consider what is in the run: command as a file to open, not an app. – user2482876 Jul 25 '13 at 12:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.