# Using OpenSC on Mac OS X

First you need Mac OS X Version 10.4 or later. Older version are supposed to not work well, but if you try and have success, please report here. I report! it worked for me under 10.3.9 G4 1,2Ghz, and i can use my mpmanF50 again. Thanks. reach me nicolasb at gmaildotcom. French tutorial here : http://nicolasbizard.free.fr/blog

Then you need a driver for your smart card reader. Hier is an examle for Axalto e-gate tokens: * Download and install libusb. http://libusb.sourceforge.net/ * Download ifd-egate from http://www.luusa.org/~wbx/sc/ifd-egate-0.05-patched.tar.gz

To install libusb, you need to extract the files, configure it, make, make install:

    wget http://switch.dl.sourceforge.net/sourceforge/libusb/libusb-0.1.10a.tar.gz
    tar xfvz libusb-0.1.10a.tar.gz
    cd libusb-0.1.10a
    ./configure --prefix=/opt/smartcard
    make
    make install
    cd ..

To install ifd-egate you need to extract the files, and use some environment variables to make sure it finds everything (or edit the compile options in the Makefile directly):

    wget http://www.luusa.org/~wbx/sc/ifd-egate-0.05-patched.tar.gz
    tar xfvz ifd-egate-0.05-patched.tar.gz
    cd ifd-egate-0.05
    export USB_CFLAGS="-I/opt/smartcard/include -I/System/Library/Frameworks/PCSC.framework/Headers"
    export USB_LDFLAGS="-L/opt/smartcard/lib -lusb -Wl,-framework -Wl,PCSC"
    make -f Makefile-OSX clean
    make -f Makefile-OSX
    make -f Makefile-OSX install
    export USB_CFLAGS=
    export USB_LDFLAGS=
    cd ..

Last you need to download and install opensc. This is straight forward: download, extract, configure, make, make install.

    wget http://www.opensc-project.org/files/opensc/opensc-0.9.6.tar.gz
    tar xfvz opensc-0.9.6.tar.gz
    cd  opensc-0.9.6
    ./configure --prefix=/opt/smartcard --sysconfdir=/etc
    make
    make install
    cd ..

## SSH with smartcard support

Mac OS X does include openssh, but unfortunatly compiled without smartcard support. Here is how you can recompile openssh with it:

    wget ftp://ftp.leo.org/pub/OpenBSD/OpenSSH/portable/openssh-4.1p1.tar.gz
    tar xfvz openssh-4.1p1.tar.gz
    cd  openssh-4.1p1
    ./configure --prefix=/opt/smartcard --sysconfdir=/etc --with-opensc=/opt/smartcard
    make
    make install
    cd ..