Settings up HTSQL on Mac Lion

Introduction

In order to use HTSQL on my Raspberry PI I decided to install a local copy first so I could experiment with it.

The steps below are for HTSQL setup on a Mac Book Pro running Lion.

Setup steps for installing HTSQL on Mac Lion

Step 1: Setup machine ready for HTSQL install

Ensure that all required packages are installed. You will need the following:

X11  –  http://developer.apple.com/opensource/tools/x11.html

X code –  With Lion you can install X code directly from the App store.
You will need to use your ITunes login, or create a new Apple ID if you do not have one.
When attempting to download from the App store you will be prompted for the above and given the opportunity to create an account if you don’t have one.

Once downloaded, the App store will show you Xcode as being installed. However this is misleading. You will need to navigate to your Applications folder and run the Install Xcode installer.

Macports – Follow the link below for a guide to Macports:

http://guide.macports.org/

The latest Lion dmg can be downloaded for the link below:

https://distfiles.macports.org/MacPorts/

Mercurial – Once the above packages have been installed, you can now install Mercurial which will allow you to clone the HTSQL repository to your local machine.

Load up terminal and run the following command:

sudo port install mercurial

This will install a number of packages onto your machine.

Step 2 – Install HTSQL

On your Mac you can now clone the HTSQL repository to your local machine (this will clone to Users/username for example):

Load Terminal and from the command line run the following command (note: check htsql.org for the latest bitbucket path)

hg clone https://bitbucket.org/prometheus/htsql

Once this is complete you should be able to navigate to the HTSQL directory:

cd htsql

To install HTSQL run the following commands:

make build

and then

sudo make install

You can test your installation by running the following from the command line:

run htsql-ctl help

You should now see HTSQL help running.

Using the HTSQL documentation you can now connect to a database on your machine.

HTSQL works with a variety of databases, the easiest to get started with is probably SQlite

These above steps for example were tested against a sqlite DB using the server command and running on localhost:8080

e.g.

htsql-ctl server sqlite:../../../Applications/XAMPP/xamppfiles/htdocs/mydatabase/test.db

Starting an HTSQL server on User-MacBook-Pro.local:8080 over ../../../Applications/XAMPP/xamppfiles/htdocs/mydatabase/test.db

Conclusion

The process above is fairly simple although does require on the Mac a number of packages in order to work. If you have a Linux machine the process is far simpler.  Installing HTSQL on the RPI for example should be a fairly quick process

Further instructions on installation and compilation of HTSQL can be found here.