1

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?

4
  • 1
    How did you update curl?
    – mmmmmm
    Commented Jun 15, 2016 at 0:23
  • I updated it with homebrew.
    – sycer
    Commented Jun 16, 2016 at 7:27
  • You did not update it you added another curl in a different place and applescript does not have to on its path
    – mmmmmm
    Commented Jun 16, 2016 at 7:39
  • The do shell script command gets passed "/usr/bin:/bin:/usr/sbin:/sbin" as the $PATH and therefore any commands called that are not within that path need to use the fully qualified pathname in the command. This also applies to commands called in Automator when using Run Shell Script and Run AppleScript actions too. Commented Jun 16, 2016 at 12:45

1 Answer 1

-1

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\""

1
  • 1
    two things wrong - it is not an optional version it is just another version. Home-brew does not put things in /opt/local - Macports does that. The general issue of using the full path os correct
    – mmmmmm
    Commented Jun 16, 2016 at 7:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .