Enabling HTTPS support in curl installed through MacPorts on OSX

by rp

While doing development just noticed that if you have installed php with curl support using macports it does’nt install ssl support in curl by default which is quite frustrating. Especially I just spent 30mins of my life trying to debugging what had gone wrong.

This is what you would get if you have a similar problem:

% curl -k https://www.yahoo.com
curl: (1) Protocol https not supported or disabled in libcurl

The problem is that you would usually have something that depends on curl so you cant install the version of curl with its variant straightaway, so you will first need to remove the dependent first, then remove curl and clean up the install and then finally install curl with its ssl variant followed by its dependents.

The steps are something like this:

busybox:web rp$ sudo port uninstall curl @7.19.3_0 curl @7.19.3_0+ssl
--->  Unable to uninstall curl 7.19.3_0, the following ports depend on it:
--->  	php5
Error: port uninstall failed: Please uninstall the ports that depend on curl first.
busybox:web rp$ sudo port uninstall curl @7.19.3_0 curl @7.19.3_0+ssl
busybox:web rp$ sudo port uninstall php5
--->  Deactivating php5 @5.2.9_0+apache2+macosx+mysql5+pear+sqlite
--->  Uninstalling php5 @5.2.9_0+apache2+macosx+mysql5+pear+sqlite
busybox:web rp$ sudo port uninstall curl @7.19.3_0 curl @7.19.3_0+ssl
--->  Deactivating curl @7.19.3_0
--->  Uninstalling curl @7.19.3_0
--->  Uninstalling curl @7.19.3_0+ssl
busybox:web rp$ sudo port install php5 @5.2.9_0+apache2+macosx+mysql5+pear+sqlite
Error: Requested variants do not match original selection.
Please perform 'port clean curl' or specify the force option.
Error: The following dependencies failed to build: curl
Error: Status 1 encountered during processing.
busybox:web rp$ sudo port clean curl
--->  Cleaning curl
busybox:web rp$ sudo port clean php5
--->  Cleaning php5
busybox:web rp$ sudo port clean php5
--->  Cleaning php5
busybox:web rp$ sudo port clean curl
--->  Cleaning curl
busybox:web rp$ sudo port clean php5
busybox:web rp$ sudo port install curl +ssl
--->  Fetching curl
--->  Verifying checksum(s) for curl
--->  Extracting curl
--->  Configuring curl
--->  Building curl
--->  Staging curl into destroot
--->  Installing curl @7.19.3_0+ssl
--->  Activating curl @7.19.3_0+ssl
--->  Cleaning curl
busybox:web rp$ sudo port install php5 @5.2.9_0+apache2+macosx+mysql5+pear+sqlite
--->  Fetching php5
--->  Verifying checksum(s) for php5
--->  Extracting php5
--->  Applying patches to php5
--->  Configuring php5
--->  Building php5
--->  Staging php5 into destroot
Warning: php5 requests to install files outside the common directory structure!
--->  Installing php5 @5.2.9_0+apache2+macosx+mysql5+pear+sqlite

If this is your first install, you might want
cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so

* copy  /opt/local/etc/php.ini-dist to  /opt/local/etc/php.ini
--->  Activating php5 @5.2.9_0+apache2+macosx+mysql5+pear+sqlite
--->  Cleaning php5