Mikkel Høgh

Coding the web since 1999

16 Jul 2013

Installing LedgerSMB with Homebrew on OS X

I use LedgerSMB for doing the finances for Drupal Danmark and Högh I+O. I recently moved my installation to a Mac, and reinstalled it with Homebrew.

I thought my installation notes might be useful to others, so there they are. Shell commands are denoted with $. The $ is not part of the command, so leave it out if you copy and paste.

This assumes that you have Homebrew set up and configured, so it will use the Perl version installed from Homebrew rather than the one that ships with OS X.

Take a gander at my .zshrc if you need inspiration on how to set that up.

  1. Download LedgerSMB
  2. Go to its folder (in this case, /Users/mikl/Sites/ledgersmb)
  3. $ brew install perl httpd (be sure to read the instructions on how to run Apache HTTPD as a service, homebrew will tell you the commands to use).
  4. $ cpan install Module::Install Data::Dumper Log::Log4perl Locale::Maketext DateTime Locale::Maketext::Lexicon DBI MIME::Base64 Digest::MD5 HTML::Entities DBD::Pg Math::BigFloat IO::File Encode Locale::Country Locale::Language Time::Local Cwd Config::Std MIME::Lite Template Error CGI::Simple File::MimeInfo Config::Std
  5. $ vim /usr/local/etc/apache2/httpd.conf
    and change the port number to something else. In this example I’m using 34567.
    Additionally, add Include /usr/local/etc/apache2/extra/ledgersmb-httpd.conf on a single line at the end of the file.
  6. $ cp ledgersmb-httpd.conf.template /usr/local/etc/apache2/extra/ledgersmb-httpd.conf
  7. $ vim /usr/local/etc/apache2/extra/ledgersmb-httpd.conf
  8. Replace WORKING_DIR with /Users/mikl/Sites/ledgersmb
  9. $ cp ledgersmb.conf.default ledgersmb.conf
  10. Edit ledgersmb.conf and set contrib_dir to /usr/local/share/postgresql/extension
  11. $ perl -p -i -e 's/^#!\/usr\/bin\/perl/#!\/usr\/local\/bin\/perl/' *.pl
  12. Go to http://localhost:34567/ledgersmb/setup.pl and configure the database. You will need to have PostgreSQL installed and configured for this step, but since I already had that, I will not cover it here.