Install LedgerSMB 1.3 Beta 4 on OSX

Not gonna lie, installing LedgerSMB 1.3 Beta 4 on OSX is harder than it should be. I imagine it is next to impossible for the average small business owner to create a working installation. Not a good thing since small businesses could benefit greatly from the software. Here's how I got LedgerSMB up and running on OSX Leopard.

Software
* PostgreSQL
* Perl
* Homebrew
* gnu-sed
* gnu-getopt
* LedgerSMB 1.3 Beta 4

PostgreSQL
EnterpriseDB provides a nice OSX installer here http://www.enterprisedb.com/products-services-training/pgdownload#osx. I used version 9.0.4-1. You will need to restart your computer as part of the installation. After restarting run the installer again. Install with the default values. Set and remember a password for the postgres user when prompted. Don't launch the Stack Builder at exit.

Perl
Perl comes installed on OSX. I had version 5.10.0 installed.

Homebrew
Homebrew allows you to easily build other needed software. Get it here http://mxcl.github.com/homebrew/.

gnu-sed
The install scripts for LedgerSMB aren't compatible with the default version of sed shipped with OSX. We need to install gnu-sed.
$ brew install gnu-sed
$ sudo mv /usr/bin/sed /usr/bin/sed-bsd
$ sudo ln -s /usr/local/Cellar/gnu-sed/4.*/bin/gsed /usr/bin/sed
The above commands installs gnu-sed and makes it useable.

gnu-getopt
We need gnu-getopt for the same reason as gnu-sed.
$ brew install gnu-getopt
$ sudo mv /usr/bin/getopt /usr/bin/getopt-bsd
$ sudo ln -s /usr/local/Cellar/gnu-getopt/1.*/bin/getopt /usr/bin/getopt

As an alternative to installing Homebrew and installing gnu-sed and gnu-getopt I made binaries of these programs available as gnu.zip. Just unzip to /usr/bin. Make backups of the original getopt and sed if you care about them.

LedgerSMB
Download http://downloads.sourceforge.net/project/ledger-smb/Beta%20Releases/1.3.... and extract to /usr/local/. Your LedgerSMB directory should be /usr/local/ledgersmb.

Installation
Go to the location of ledgersmb and run the makefile. Select yes to installing the required modules. Select no for the optional ones.
$ cd /usr/local/ledgersmb
$ perl Makefile.PL

Run make install. This installs the required perl modules.
$ sudo make install

Modify the tools/prepare-company-database.sh file. Replace line 190 with the following.
cat <<EOF | psql -U postgres -d postgres 2>&1 | unchatter

Run prepare-company-database.sh. The option --coa sets the charter of accounts. I selected an Australian coa. You will be prompted for your postgres password.
$ sudo tools/prepare-company-database.sh --company yourcompanyname --pgsql-contrib /Library/PostgreSQL/9.0/share/postgresql/contrib --coa sql/coa/au/chart/General-00000.sql

Copy the apache config to the correct folder and restart apache.
$ sudo cp ledgersmb-httpd.conf /etc/apache2/other
$ sudo /usr/sbin/apachectl restart

Copy and modify the default ledgersmb.conf file. Change the default_db value to ledgersmb.
$ cp ledgersmb.conf.default ledgersmb.conf

Now go to http://localhost/ledgersmb/. Log in with username admin, password admin, and company yourcompanyname.

© 2012 Invenn PTY. LTD.