Archive | OSX RSS feed for this section

Installing paramiko for SSH/SFTP in Python on OS X

20 Aug
How

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+.

Prerequisites:

XCode – http://developer.apple.com/xcode/ (or from your OSX install disk)
MacPorts – http://www.macports.org
Python setuptools – http://pypi.python.org/pypi/setuptools

Procedure:

  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 – http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.3.tar.gz
  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 setup.py 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 setup.py 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