# Download and installation

You can download the easy-to-install packages for pev that we call pre-compiled binaries. This is the easiest way to start using pev, although you may want to compile it in your environment if you feel comfortable but that will require you to install dependencies, some libraries headers and some programs too.

If you choose to use the pre-compiled binaries (recommended for beginners), you just need to download its package from our download page. There are pre-compiled binaries for Windows and DEB and RPM packages for Linux. OS X users can use MacPorts to install pev, while Linux users can also opt out for using the native package manager.

## Using the pre-compiled binaries

### On GNU/Linux

We recommend you to use your package manager for that, but in case pev is outdated or not present in your package manager repositories, you can still use it by compiling it from the sources.

### On Windows

Just download the ZIP package and uncompress it in any directory you want. There is a handy script called run.bat that you can use to open a Command Prompt window in pev's directory. This script also configures the environment for proper working of pev toolkit. You can also consider adding the pev's directory to PATH variable to make use of pev tools even easier.

After running the script you should see a window like this:

You DON'T need to install Cygwin to run pev in Windows. Cygwin is only needed if you want to compile pev toolkit by your own.

### On Mac OS X

If you haven't, please install either Homebrew or MacPorts first, then open a Terminal window and run one of the following commands:

    $ brew install pev

    $ sudo port install pev

## From the sources

Go to , and download the tarball named pev-x.xx.tar.gz, where x.xx is the version number you want.

You can have the most up to date source code from the pev repository on GitHub (recommended). If you have git installed, run the following:

`$` `git clone --recursive git://github.com/mentebinaria/readpe.git`

Even without git installed, you can download a ZIP or tarball file from project web page on GitHub.

### Compiling on GNU/Linux

Make sure you have the following dependencies installed and working properly:

- libpe (included with in the repository under lib/libpe)
- libssl (used by pehash and pesec)
- gcc
- make

If you have downloaded the tarball, uncompress it with tar command:

    $ tar xf pev-x.xx.tar.gz
    $ cd pev-x.xx

If you've cloned the git repository, it's time to compile pev and its libraries:

    $ make
    # make install (root privileges needed)

If your Linux distribution does not set /usr/local/lib as one of default locations for libraries, you may need to create a symlink like this:

    # ln -s /usr/local/lib/libpe.so.1.0 /usr/lib/libpe.so.1

The commands above will compile libpe and all pev binaries. You can set DEST and PREFIX variables if you need. For compiling libpe only, enter in its directory and issue make command, as this:

    $ cd lib/libpe
    $ make

To compile individual pev binaries, use:

    $ cd src/
    $ make program

In order to use any pev binary you should compile and install libpe first.

### Compiling in Windows (via Cygwin)

The first step is to download and install Cygwin. During the installation process, you must select at minimum the following packages:

- gcc-core
- binutils
- make
- zip
- openssl-devel
- git (just to clone the repository and make things easier)

You should follow the same compilation steps for GNU/Linux, replacing "make install" by "make zip" at the end:

    $ make zip

A file pev-x.xx.zip will be created and can be extracted in any directory you choose. All pev tools can be called directly from Windows Command Prompt (cmd.exe). You can add the pev's directory in %PATH% environment variable in order to call pev tools from anywhere.

You can't call "make install" under Cygwin.

### Compiling in OS X

We recommend you use one of the following package managers to install dependencies first when compiling in OS X:

- Homebrew - http://brew.sh/
- MacPorts - http://www.macports.org

For Homebrew, use:

    $ brew install <pkgname>
    $ make CFLAGS="-I/opt/local/include"

For MacPorts, use:

    $ sudo port install <pkgname>
    $ make CFLAGS="-I/opt/local/include"

The directories above may change depending on your package manager installation settings.

### Compiling in other platforms

As pev is written in standard C language, we encourage you to compile it in different platforms and let us know about that. We believe pev can be compiled in many different platforms with just a few or no patches, but you may face some dependencies challenges. Anyway, we encourage you to get in touch to discuss.

Previous versions were compiled for Android, Solaris and other systems. If you want to give it a try, go ahead! ;)

### Output retro-compatibility

As of version 0.70 the output format of pev programs changed. If you have some scripts calling pev and parsing the old 0.60 output format, you can define a macro called LIBPE_ENABLE_OUTPUT_COMPAT_WITH_V06 before compilation, just like this:

    $ DFLAGS+=-DLIBPE_ENABLE_OUTPUT_COMPAT_WITH_V06 make readpe

This retrocompatibility will be removed in the next release, so please consider updating your scripts as soon as possible.