[R-SIG-Mac] sh: convert: command not found

Matt Denwood md at sund.ku.dk
Fri Oct 24 13:40:44 CEST 2014


On 24 Oct 2014, at 13:36, peter dalgaard <pdalgd at gmail.com> wrote:

> 
> On 24 Oct 2014, at 12:55 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> 
>> On 24/10/2014, 1:37 AM, Simon Urbanek wrote:
>>> 
>>> On Oct 24, 2014, at 12:22 AM, Emma Sherratt <emma.sherratt at gmail.com> wrote:
>>> 
>>>> Dear Mac R community,
>>>> 
>>>> I wonder if anyone else has come across this issue. After installing the
>>>> new Mac OS10.10 Yosemite, I am now having a strange problem.
>>>> 
>>>> I'm trying to use movie3d and run similar functions based on this I have
>>>> written myself.
>>>> 
>>>> Specifically, when I run
>>>> 
>>>>> system("convert --version")
>>>> sh: convert: command not found
>>>> 
>>>> yet, it is not a path issue.
>>>>> Sys.getenv("PATH")
>>>> [1]
>>>> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:
>>>> */opt/ImageMagick/bin*:/usr/texbin"
>>>> 
>>> 
>>> It is, because Yosemite ignores PATH for processes started from a GUI application. You will see if you run
>>> system("echo $PATH")
>>> 
>>> You have to use full paths in Yosemite for anything that is not on the "sanctioned" PATH -- or use R from the shell.
>> 
>> What is the best way to find the full path to a command there, since
>> Sys.which() sees the same PATH as system() does?
>> 
>> Alternatively, how do you modify the PATH that system() sees?
>> 
>> Duncan Murdoch
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 
> Disclaimer: I'm at the office computer right now, still on Mavericks.
> 
> In my limited experimentation, I found that you can pass the PATH explicitly as in 
> 
> path <- Sys.getenv("PATH")
> cmd <- paste("PATH=", path, "; which pdflatex")
> system(cmd)
> 
> I don't recall needing to export PATH, and there could be complications with the shell flavour (sh, ash, bash, zsh, ...). Also, I think it wants to be two commands with the intervening semicolon, but it might work without it. Anyways, give it a try.
> 

Just to confirm it works if you use export in the same shell process, i.e.:

system('echo Old path: $PATH; which jags; export PATH="/usr/local/bin:$PATH"; echo New path: $PATH; which jags’)

Not an ideal solution of course, as every call to system() needs to be modified … but at least it does work (for me at least).

Matt


Matthew Denwood BVMS PhD FHEA MRCVS
Associate Professor in Quantitative Veterinary Epidemiology and Biostatistics
Department of Large Animal Sciences
Section for Animal Welfare and Disease Control
Faculty of Health and Medical Sciences
University of Copenhagen
Grønnegårdsvej 8
1870 Frederiksberg C
Phone:  +45 35 33 23 07
Email:  md at sund.ku.dk


> -- 
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list