Call system command with system() but command not found


I want to show youtube video with oF. with ‘youtube-dl’, i can get video format and playable video address.
but weirdly, run system("youtube-dl [options]") is not working on mac. console says sh: youtube-dl: command not found.

I install youtube-dl with brew, and update with curl (from youtube-dl github). with console, youtube-dl is working but not with system() in openframeworks.

this approach is working well in linux.
anyone can help?


hmm. because i suspect that sh (from oF) has no PATH environment… I tested /usr/local/bin/youtube-dl, instead of 'youtube-dl` and it works…

why this happen and… how can I add PATH environment in terminal(in oF)?


you have to add your path manually to get system() to operate like the command line – you can do

echo $PATH

from the command line to see what it is. then you can use a command line this


export PATH=$PATH:~/opt/bin

in your system command, such as “export PATH=$PATH:~/opt/bin; blah…”


ps: similar issue here


hmm. thank you for your suggession. I’ll try soon in my mac.

but, why works without add path manually in linux? interesting…


ok. command not found solved!
as I tested, everytime I run ofSystem(cmd), have to export PATH.

but sadly stuck with another issue.

unlike linux, I got another error message from xcode console.
I can hear sound(!) but not video.
here’s a error message.

2019-07-20 00:31:36.761168+0900 2019youtubeTest[2280:96189] sendMessageWithDictionary: Failed to get remote object proxy: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named" UserInfo={NSDebugDescription=connection to service named}
[warning] ofGLRenderer: draw(): texture is not allocated
2019-07-20 00:41:11.213019+0900 2019youtubeTest[2551:117867] [default] Invalid display 0x533f0642

I googled and guess it related with something security by apple, probably??

I checked that option. but nothing changed…


I should open new thread it’s not realated ofSystem.
-> "Failed to get remote object proxy" issue