Problem “do shell script” on curl – Works in Terminal, but not via “do shell script”

applescriptcommand lineterminal

I want to use "curl" with "do shell script" in an apple script. It already worked some months ago, but then the provider changed to https-only service.

So I update curl on Mac OS Terminal:

$ curl -V
curl 7.49.0 (x86_64-apple-darwin10.8.0) libcurl/7.49.0 OpenSSL/1.0.2h zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets

So it works in Terminal and gives back the right answer:
enter image description here

But when I try to call the same command via do shell script in Apple Script it responds this:
enter image description here

So – is the problem, that curl in the do shell script environment isn't updated – and how could I do this? Or what is the problem?

Best Answer

I've found the solution. The problem is, that homebrew installed an optional newer version of curl, but the command do shell script does use the old version.

After a hint from a friend I used which curl in terminal and apple script editor and get different results:

Terminal says: /opt/local/bin/curl
Apple Script do shell script says: /usr/bin/curl

So the solution for my problem is to force do shell sript to use the newer version via:

do shell script "/opt/local/bin/curl \"https://v.gd/create.php?format=simple&url=http://www.test.de\""