Skip to main content
15 events
when toggle format what by license comment
Jan 28, 2023 at 23:25 vote accept quark67
Jan 28, 2023 at 20:46 comment added quark67 @nohillside Done.
Jan 28, 2023 at 20:46 history edited quark67 CC BY-SA 4.0
Added the code which don't work, and the error displayed
Jan 28, 2023 at 20:11 comment added red_menace Note that since the default shell environment is does not have any of your changes, everything running in that shell will have the same issue.
Jan 28, 2023 at 19:52 comment added nohillside Please edit the question to describe the actual problem, and include any output you get as well.
Jan 28, 2023 at 19:33 history edited quark67 CC BY-SA 4.0
added some precisions after discovered that when the binary calls other binary, it don't find it.
Jan 28, 2023 at 19:12 comment added quark67 @Mockman This returns "/Library/TeX/texbin:/usr/bin:/bin:/usr/sbin:/sbin". And what must I do as I discover that in fact, if do shell script "texdoc --version" is solved by adding "PATH='/Library/TeX/texbin:$PATH';" before, this don't resolve a real usage case (replacing "--version" with a LaTeX package, eg "url"). Must I edit my question? Ask another question? do shell script "export PATH='/Library/TeX/texbin:$PATH'; texdoc url" gives this error: "sh: open: command not found\rtexdoc error: Failed to execute: open \"/usr/local/texlive/2022/texmf-dist/doc/latex/url/url.pdf\"" number 1.
Jan 28, 2023 at 17:42 comment added Mockman What do you get with this? do shell script "export PATH=\"/Library/TeX/texbin:$PATH\" ; echo $PATH" Your command doesn't include the export. I think the same path will be returned either way but I'm not sure that the path will be available to any subsequent commands without the export.
Jan 28, 2023 at 16:25 answer added nohillside timeline score: 3
Jan 28, 2023 at 14:37 comment added quark67 @Mockman The command that doesn't work is do shell script "/Library/TeX/texbin/texdoc --version". Why, because I have append the complete path to it (/Library/TeX/texbin/texdoc is the complete path). What is the difference with do shell script "PATH="/Library/TeX/texbin:$PATH"; texdoc --version" suggested by Gordon Davisson, and works? Moreover, but I probably need to ask another question (?), if I try do shell script "PATH='/Library/TeX/texbin:$PATH'; texdoc url", yet it's the "open" command which isn't found (texdoc call open to display the PDF "url.pdf" in Preview app).
Jan 28, 2023 at 13:39 comment added quark67 @GordonDavisson Yes your command command works (by replacing the inners "with '), thanks, but why doesn't my version works despite I have append the complete path to the command?
Jan 28, 2023 at 13:36 comment added quark67 @Mockman Among differences, in the Terminal, env outputs PATH=/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin and by AppleScript, I obtain only PATH=/usr/bin:/bin:/usr/sbin:/sbin. For which tex I obtain /Library/TeX/texbin/tex in the Terminal and the error "The command exited with a non-zero status." number 1 in AppleScript. But why my command doesn't work when I append the complete path to the CLI command?
Jan 28, 2023 at 11:03 comment added Gordon Davisson /Library/TeX/texbin/texdoc is probably a shell script that depends on other scripts/programs in /Library/TeX/texbin. That directory is in your PATH in an interactive shell, but not in the shell that do shell script creates. Try do shell script "PATH="/Library/TeX/texbin:$PATH"; texdoc --version"
Jan 28, 2023 at 9:04 comment added Mockman FWIW, the shell used here has a different environment than that of the Terminal. Try running env in the terminal and then run it in Script Editor with do shell script "env". Note especially the difference in PATH. Then try do shell script "which tex" and compare. For some explanation by apple, take a look at their tech note on the subject: TN2065. You can do most stuff, you just need to take this into account.
Jan 28, 2023 at 5:24 history asked quark67 CC BY-SA 4.0