Installing cryptography (part of Scrapy) on Mac OS X

Sep 16, 2016 · Updated: Nov 09, 2017 · by Tim Kamanin

I'm leaving this tip as a note for myself, but I hope someone will find it useful too.

If you try to install Scrapy or cryptography on Mac OS X, your pip install will likely fail with the message similar to this:

build/temp.macosx-10.9-x86_64-2.7/_openssl.c:433:10: fatal error: 'openssl/opensslv.h' file not found

#include <openssl/opensslv.h>


1 error generated.

error: command 'clang' failed with exit status 1

The problem lies within OpenSSL that comes with Mac OS X. We can easily solve the problem in two steps

1. You'll need to install another one from Homebrew at first:

brew install openssl

2. Install cryptography using newly installed openssl, like this:

env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

Now run your Scrapy installation once again and get ready to scrape the World:

pip install Scrapy

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓