curl-users
Re: Ship curl command line tool with Mac OS X software
Date: Mon, 27 Oct 2014 17:46:38 -0500
> On Oct 27, 2014, at 10:51 AM, Marco Baldassarre <m.baldassarre_at_gmde.it> wrote:
>
> Hi there,
> I currently rely in my Mac application on curl command line tool shipped with Mac OS X and installed by default in /usr/bin/curl.
>
> Altho this approach has worked so far, I have found some inconsistencies between 7.24 and 7.30 versions of cURL regarding the use of double-quotes marks in the syntax.
>
> As such, I'd like to change my approach and ship a compiled version of cURL with my software, without relying anymore on the (changing between OS versions) cURL supplied by the Mac OS X platform.
>
> How can I do that? Ideally, I'd like to have a 7.30 version that I can call from /Applications/MyApp/bin/curl , and that works on Mac OS X from 10.7 to 10.10 without being dependent on any other library.
I'm curious as to why you need the curl tool specifically. If you need to do something in curl within an OS X app, then you ought to use libcurl in your app instead of fork()/exec()-ing a curl process.
Anyway, if there's a good reason that you need the curl tool specifically, then you can do this (and this will work for any other tool you want to include in your app):
1. Install the latest command line tools on your computer, if you haven't done so already: xcode-select --install
2. Download the source code from <http://curl.haxx.se/>, un-pack it, and CD into its directory from the command line
3. Set the global environmental variable "MACOSX_DEPLOYMENT_TARGET" to "10.7" (or whatever your version requirement is; curl will go back as far as OS X 10.5)
4. Make a static build: ./configure --disable-shared --with-darwinssl --enable-threaded-resolver ; make -j `sysctl -n hw.logicalcpu_max`
(Note: OpenSSL is deprecated on OS X, but if you specifically need OpenSSL support for some reason, then omit the --with-darwinssl flag. And if you don't want TLS at all, then use --without-ssl.)
5. The tool will be located at ./src/curl after it's done building, so copy it into your project
6. You can then get the tool's path inside your app's bundle by using the CFBundle or NSBundle APIs
Nick Zitzmann
<http://www.chronosnet.com/>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-27