Install

Compatibility:

Tested on OS X and Linux. Runs on Python 2.6, 2.7, 3.3 and 3.4.

I have not personally tested this on Windows, but all the underlying libraries used by this project are cross-platform compatible including Windows. If you have a Windows machine, I'd very much appreciate if you could test it out and let me know. I do want to support Windows, I just don't have the resources right now.

Quick start:

If you already know how to install python packages, then you can do:

$ pip install pgcli

or

$ easy_install pgcli

You might need sudo.

Detailed:

Mac OS X:

The easiest way install pgcli in an OS X machine is to use homebrew. Please be aware that this will install postgresql via homebrew.

$ brew install pgcli

That's it. You can now launch it by typing pgcli on the command line.

If you have Postgresql installed via different means instead of brew, you can try:

$ brew install --build-from-source pgcli

This will skip installing Postgresql, if it is already available in the $PATH.

Alternatively, since pgcli is a python package you can install it via the python package manager pip. There is also an older package manager known as easy_install but it is replaced by pip.

Check if pip is installed on the system.

$ which pip

If the above command returns an error, then you do not have pip installed on your computer.

Most OS X systems comes pre-installed with python and easy_install. You can use easy_install to install pip.

$ sudo easy_install pip

pgcli uses psycopg to talk to postgres database. In order to install psycopg, you will need libpq installed on your system. The easiest way to get the necessary libraries, is to install postgresql on your system.

$ brew install postgresql

You will also need C compiler installed on your system in order to compile the required files for psycopg. Install XCode from AppStore and then install the CommandLineTools which will install gcc or an equivalent C compiler on your system. I typically do the following:

$ xcode-select --install   # This will install the command line tools for xcode.

Now that the required dependencies are satisfied you are ready to install pgcli.

$ sudo pip install pgcli

Linux:

The recommended way to install Python packages is to use a package manager called called pip. There is also an older package manager known as easy_install but it is replaced by pip.

Check if pip is installed on the system.

$ which pip

If the above command returns an error, then you do not have pip installed on your computer. You can install it using your OS package manager.

Debian based systems (Debian, Ubuntu, Mint etc)

$ sudo apt-get install python-pip

For Redhat based systems (Fedora, Centos, RHEL etc)

$ sudo yum install python-pip

Pgcli uses psycopg to talk to postgres database. In order to install psycopg, you will need libpq and python-dev installed on your system. Since psycopg is a C extension for Python, a C compiler is needed to install it on your system.

$ sudo apt-get install libpq-dev python-dev   # debian

or

$ sudo yum install postgresql-devel python-devel  # redhat

Now that the required dependencies are satisfied you are ready to install pgcli.

$ sudo pip install pgcli

If you're having trouble getting this installed please feel free to contact me.

blogroll

social