Installing Juniper’s Python module py-junos-eznc on Mac OSX Mavericks

python-logo-master-v3-TMIf you are a networking type who works with Juniper gear, you’ve no doubt heard a lot about automation over the past couple of years. Maybe you’ve heard about Puppet and Chef integration, and maybe Ansible integration, and if you ever ran into Jeremy Schulman, you heard about Py-EZ. Maybe you’re interested in checking this out. Maybe you’re a Mac User and you don’t really want to spin up a VM of linux to check it out. If so, read on.

OSX Mavericks ships with python 2.7 but does not include several tools required for installation of the junos-eznc python modules. Mavericks is specifically missing the xmlsoft tools libxml2 and libxslt. Additionally Mavericks does not include pip.

You can easily install pip by following the instructions at https://pip.pypa.io/en/latest/installing.html

There are pre-compiled binaries of libxml2 and libxslt, but it’s probably safer to build these tools from their source. To do this, you need a few other tools from the public domain: GNU autoconf (because libxml2 doesn’t include a configure file, only a configure.ac file), GNU automake, GNU help2man (because the full text of the man pages is delivered in textinfo rather than man pages format).

This guide assumes that you’ve installed Xcode and Xcode Command Line tools.

Install autoconf
  1. Download the latest gzip tar file from http://ftp.gnu.org/gnu/autoconf/ (as of 20150626 this is autoconf–2.69.tar.gz)
  2. Run the command “tar xzvf autoconf–2.69.tar.gz”
  3. Change diredctories into the resulting autoconf source directory.
  4. Run the command “autoconf” to generate a configure file.
  5. Run the command “./configure” to generate a Makefile.
  6. Run the commands to build source and install the resulting binary.
    make
    sudo make install
Install automake
  1. Download the latest gzip tar file from http://ftp.gnu.org/gnu/automake/ (as of 20150626 this is automake–1.15.tar.gz)
  2. Run the command “tar xzvf automake–1.15.tar.gz”
  3. Change diredctories into the resulting autoconf source directory.
  4. Run the command “autoconf” to generate a configure file.
  5. Run the command “./configure” to generate a Makefile.
  6. Run the commands to build source and install the resulting binary.
    make
    sudo make install
Install xz (required by libxml2)
  1. Download the latest zx source from http://tukaani.org/xz/ (as of 20150626 this is xz–5.2.1.tar.gz)
  2. Run the command “tar xzvf xz–5.2.1.tar.gz”
  3. Change diredctories into the resulting autoconf source directory.
  4. Run the command “autoconf” to generate a configure file.
  5. Run the command “./configure” to generate a Makefile.
  6. Run the commands to build source and install the resulting binary.
    make
    sudo make install
Install help2man (required by libxml2 and libxslt builds)
  1. Download help2man http://www.gnu.org/software/help2man/ (as of 20150626 this is help2man–1.47.1.tar.xz)
  2. Run the command “tar xzvf help2man–1.47.1.tar.xz”
  3. Change diredctories into the resulting autoconf source directory.
  4. Run the command “autoconf” to generate a configure file.
  5. Run the command “./configure” to generate a Makefile.
  6. Run the commands to build source and install the resulting binary.
    make
    sudo make install
Install libxml2
  1. Download libxml2 from ftp://xmlsoft.org/libxml2/ (as of 20150626 this is libxml2-sources–2.9.2.tar.gz)
  2. Run the command “tar zxvf libxml2-sources–2.9.2.tar.gz”
  3. Change diredctories into the resulting autoconf source directory.
  4. Run the command “autoconf” to generate a configure file.
  5. Run the command “./configure” to generate a Makefile.
  6. Run the commands to build source and install the resulting binary.
    make
    sudo make install
Install libxslt
  1. Download libxslt from ftp://xmlsoft.org/libxslt/ (as of 20150626 this is libxslt–1.1.28.tar.gz)
  2. Run the command “tar zxvf libxslt–1.1.28.tar.gz”
  3. Change diredctories into the resulting autoconf source directory.
  4. Run the command “autoconf” to generate a configure file.
  5. Run the command “./configure” to generate a Makefile.
  6. Run the commands to build source and install the resulting binary.
    make
    sudo make install
Install pip
  1. Follow the guide at https://pip.pypa.io/en/latest/installing.html or run the command “easy_install pip”
Install junos-eznc with pip
  1. sudo pip install junos-eznc or pip install git+https://github.com/Juniper/py-junos-eznc.git