Installing paramiko for SSH/SFTP in Python on OS X

20 Aug

This installation was performed on a 2.6GHz Intel Core i7 iMac with 16GB RAM running OSX Lion 10.7.7. I used XCode 4.2 with iOS SDK 5 beta 3 and MacPorts 1.9.2. This should also work on earlier XCode versions and/or on OSX 10.5+.


XCode – (or from your OSX install disk)
MacPorts –
Python setuptools –


  1. Install XCode, MacPorts and Python setuptools if you haven’t already
  2. Update MacPorts to the latest release (sudo port -v selfupdate) and update any outdated software (sudo port -v upgrade outdated)
  3. Install GMP, MPFR and libmpc – sudo port -v install gmp mpfr libmpc
  4. Create a symlink to libgmp.dylib – sudo ln -s /opt/local/lib/libgmp.dylib /usr/lib/libgmp.dylib
  5. Download pycrypto source –
  6. tar – zxvf pycrypto-2.3.tar.gz
  7. cd pycrypto-2.3
  8. cd src
  9. Edit _fastmath.c and change the line #include <gmp.h> to be #include “/opt/local/include/gmp.h” instead
  10. cd ../ (go back to main pycrypto-2.3 directory)
  11. Install using sudo python install
    1. I have had some issues with the following error message – lipo: can’t figure out the architecture type of: /var/tmp//ccybzR1W.out for example
    2. If you have this issue then install using the following – sudo ARCHFLAGS=’-arch i386 -arch x86_64′ python install
  12. sudo easy_install paramiko
    1. Again if you get a lipo error, use the following – sudo ARCHFLAGS=’-arch i386 -arch x86_64′ easy_install paramiko

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: