The OpenSSL Blues

October 3, 2015

Apple deprecated OpenSSL in Mac OS X 10.7. So, #pragma clang diagnostic ignored "-Wdeprecated-declarations". Problem solved, right? With the Mac OS X 10.11 SDK, however, Apple took one more step — or giant leap — of removing the OpenSSL headers entirely. New problem.

Your first thought may be to compile OpenSSL yourself from source and embed it in your app. This turns out to be unnecessary and superfluous, though, because OS X 10.11 still includes /usr/lib/libcrypto.dylib, as before. Indeed, it seems likely that Apple will have to continue shipping libcrypto in OS X for years to come, in order to preserve binary compatibility. Thus, the solution is simple:

  1. Copy usr/include/openssl from the 10.10 SDK into your project.
  2. Set HEADER_SEARCH_PATHS to find your copy of the headers.
  3. Profit!

I wouldn't necessarily recommend this as a permanent solution, but it does at least give you more time to explore alternatives. Apple shipped both the 10.10 and 10.11 SDKs in the first beta of Xcode 7, but they removed the 10.10 SDK after beta 4, which left many developers shocked and without much time to switch SDKs. This was a very shabby move by Apple for many reasons, but that's a subject for another post. Anyway, I didn't even realize that the 10.10 SDK was gone until OS X 10.11 and Xcode 7 shipped to the public, because I got tired of updating Xcode betas — which weren't in App Store and had to be downloaded and installed manually — so I was still running beta 4 as of a few days ago.