Skip to content

Instantly share code, notes, and snippets.

@andrisasuke
Created May 2, 2017 10:12
Show Gist options
  • Save andrisasuke/91eccace11366e626d14c5c249054e20 to your computer and use it in GitHub Desktop.
Save andrisasuke/91eccace11366e626d14c5c249054e20 to your computer and use it in GitHub Desktop.
python install m2crypto on Mac OS X
$> brew install openssl
$> brew install swig
$> env LDFLAGS="-L$(brew --prefix openssl)/lib" \
CFLAGS="-I$(brew --prefix openssl)/include" \
SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include" \
pip install m2crypto
@mehdiAberkane
Copy link

Nice is work, thanks

@xiazhibin
Copy link

perfect!!

@bingwork
Copy link

bingwork commented Jun 9, 2021

it works for me, thanks.

@mrbungie
Copy link

mrbungie commented Nov 8, 2021

If you accidentally (or purposefully) you have another version of OpenSSL these are the correct commands:

brew install [email protected]

env LDFLAGS="-L$(brew --prefix [email protected])/lib" \
CFLAGS="-I$(brew --prefix [email protected])/include" \
SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix [email protected])/include" \
pip install m2crypto

@laggardkernel
Copy link

 include/sys/_types/_int8_t.h:30: Error: Syntax error in input(1).
    error: command 'swig' failed with exit status 1

You need to make sure a real gcc (not /usr/bin/gcc, which is clang) installed. Otherwise it uses clang to build the package.

@ivanporras
Copy link

_m2crypto.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

Any solution?

@mambelli
Copy link

Worked for me (Intel Mac Ventura, openssl@3). I set the environment and to get the right Python I used python3 -m pip install m2crypto

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