Skip to content

Instantly share code, notes, and snippets.

@mapio
Last active August 29, 2015 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapio/827f072ec253c8b412f1 to your computer and use it in GitHub Desktop.
Save mapio/827f072ec253c8b412f1 to your computer and use it in GitHub Desktop.
How to install gunicorn + gevent on OS X 10.10 Yosemite

Given that I've spent a few hours to get it right, here is how I did it.

First install the required dependencies using Homebrew, by this I mean at least

brew install python libevent

Then upgrade setuptools with

curl https://bootstrap.pypa.io/ez_setup.py -o - | python

this will prevent the egg_info error while installing gevent.

Finally, install the two packages

pip install gevent gunicorn

ignoring the

yield from self.wsgi.close()
         ^
SyntaxError: invalid syntax

error (due to some known issues with a Python 3 dependency not supported by Python 2).

Once done, a very minimal test that it is correctly installed is

echo -e 'def app():\n\tpass' > app.py
gunicorn --log-level INFO --error-logfile - -k gevent app:app

that should output something like

[2014-11-18 11:00:52 +0100] [49167] [INFO] Starting gunicorn 19.1.1
[2014-11-18 11:00:52 +0100] [49167] [INFO] Listening at: http://127.0.0.1:8000 (49167)
[2014-11-18 11:00:52 +0100] [49167] [INFO] Using worker: gevent
[2014-11-18 11:00:52 +0100] [49170] [INFO] Booting worker with pid: 49170

the relevant part being that Using worker: gevent message.

Analytics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment