-
-
Notifications
You must be signed in to change notification settings - Fork 196
OS X Quickstart
Follow these instructions to get Alaveteli running locally on an OS X machine. These instructions have been tested with Xcode 4.1 on OS X Lion (10.7). We do not recommend using OS X in production.
Note: This guide is currently incomplete. Please help by posting issues to the alaveteli-dev Google group or by submitting pull requests.
Without wdg-html-validator
, you will not have a validate
command, which will raise errors like:
WARNING: HTML validation script /usr/bin/validate not found
Unless you are working on code that touches on HTML validation, you can safely ignore these warnings. If not, there may be a possibility of using Validator S.A.C. instead. You can use its validator by running, for example:
/Applications/Validator-SAC.app/Contents/Resources/weblet http://alaveteli.org
You can add parameters by running, for example:
/Applications/Validator-SAC.app/Contents/Resources/weblet 'uri=http://alaveteli.org/&output=soap12'
It's conceivable to write a wrapper around this command to emulate the validate
command from wdg-html-validator
.
PDF Toolkit has a bug that you are unlikely to encounter in development. Nonetheness, to fix the bug, you must apply a patch. Pdftk's build instructions for OS X depend on Fink, which you don't necessarily want to install.
The following instructions are an incomplete attempt to compile Pdftk on OS X without installing GCJ, which requires recompiling GCC, which takes hours. First, install Pdftk as documented below to get /opt/pdflabs/pdftk/lib/libgcj.11.dylib
. Then:
curl -O http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-1.44-src.zip
unzip pdftk-1.44-src.zip
cd pdftk-1.44-dist
curl -O https://raw.github.com/gist/1451817/eca147cb0587385b8324487a4bc9ab295ff22fbc/pdftk.patch
patch -p1 < pdftk.patch
curl -O https://raw.github.com/gist/1840053/99897c0ce3988718434e1d0fe5716b5efc39e462/pdftk-javac.patch
patch -p1 < pdftk-javac.patch
curl -O https://github.com/jpmckinney/pdftk/raw/master/libgcj-4.4.3.jar
cd pdftk
make -f Makefile.OSX-10.6
This will fail because the pdftk
binary requires pdftk.o
, which requires java_lib.o
, which is compiled with the command $(GCJ) $(GCJFLAGS) -c java_lib.jar
, for which I've found no substitute, because javac
can't compile to object code.
If you need to cleanup and start over, change to the pdftk-1.44-dist
directory and run:
cd java
make clean
If you are using OS X Lion, download Xcode from the App Store. The App Store will say that Xcode is "installed"; however, what you installed is just an installer. Run the installer (called "Install Xcode") to install Xcode.
Note: As of Xcode 4.2, a non-LLVM version of GCC is no longer included. This breaks several Homebrew recipes. We are looking into a fix.
Homebrew is a package manager for OS X. It is preferred over alternatives such as MacPorts and Fink. If you haven't already installed Homebrew, run the command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
Next, install packages required by Alaveteli:
brew install catdoc elinks gnuplot gs imagemagick libmagic libyaml links mutt poppler tnef wkhtmltopdf wv xapian unrtf
Alaveteli uses memcached
.
brew install memcached
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/memcached/*/com.danga.memcached.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
Alaveteli uses PostgreSQL by default. If you've tested Alaveteli with MySQL or SQLite, let us know in the alaveteli-dev Google group.
brew install postgresql
initdb /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
Download the DMG file and install.
RVM is the preferred way to install multiple Ruby versions on OS X. Alaveteli uses Ruby 1.8.7. The following commands assume you are using the Bash shell.
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo 'export CC=gcc-4.2' >> .bash_profile
echo [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> .bash_profile
source .bash_profile
rvm install 1.8.7
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system
rvm install 1.9.2
rvm use 1.9.2 --default
The mahoro
and pg
gems require special installation commands. Rubygems must be downgraded to 1.6.2 to avoid deprecation warnings when running tests.
rvm 1.8.7
gem update --system 1.6.2
gem install mahoro -- --with-ldflags="-L/usr/local/Cellar/libmagic/5.09/lib" --with-cppflags="-I/usr/local/Cellar/libmagic/5.09/include"
env ARCHFLAGS="-arch x86_64" gem install pg
The following is mostly from INSTALL.md.
Creates Alaveteli databases and an foi
user with password foi
.
echo "CREATE DATABASE foi_development encoding = 'UTF8';
CREATE DATABASE foi_test encoding = 'UTF8';
CREATE USER foi WITH CREATEUSER;
ALTER USER foi WITH PASSWORD 'foi';
ALTER USER foi WITH CREATEDB;
GRANT ALL PRIVILEGES ON DATABASE foi_development TO foi;
GRANT ALL PRIVILEGES ON DATABASE foi_test TO foi;
ALTER DATABASE foi_development OWNER TO foi;
ALTER DATABASE foi_test OWNER TO foi;" | psql -h localhost template1
We don't want to vendor Rails, as it causes problems locally.
git clone https://github.com/sebbacon/alaveteli.git
git submodule init
sed -i~ 's/\[submodule "vendor/rails"\]//' .git/config
sed -i~ 's/url = git:\/\/github.com\/rails\/rails.git//' .git/config
git submodule update
Note: Due to Markdown bugs, the first sed
command above does not display properly if it appears in blockquote.
Copy the example configuration files and configure database.yml
.
cp -f config/general.yml-example config/general.yml
cp -f config/memcached.yml-example config/memcached.yml
cp -f config/database.yml-example config/database.yml
sed -i~ 's/<username>/foi/' config/database.yml
sed -i~ 's/<password>/foi/' config/database.yml
sed -i~ 's/ port: 5432//' config/database.yml
sed -i~ 's/ # PostgreSQL 8.1 pretty please//' config/database.yml
Alaveteli doesn't currently use Bundler. However, you may use the following Gemfile
to install the gems.
source :rubygems
gem 'rails', '2.3.14'
gem 'pg'
# in vendor/gems
gem 'json', '~> 1.5.1'
gem 'locale', '>= 2.0.5'
gem 'gettext', '>= 1.9.3'
gem 'fast_gettext', '>= 0.4.8'
# can't activate rack if ~> used
gem 'rack', '= 1.1.0'
gem 'rdoc', '~> 2.4.3'
gem 'recaptcha', '~> 0.3.1', :require => 'recaptcha/rails'
# can't activate rspec if ~> used
gem 'rspec', '= 1.3.1'
# can't activate rspec-rails if ~> used
gem 'rspec-rails', '= 1.3.3'
gem 'routing-filter', '~> 0.2.3'
gem 'will_paginate', '~> 2.3.11'
gem 'mahoro'
gem 'memcache-client'
# :require avoids "already initialized constant" warnings
gem 'rmagick', :require => 'RMagick'
gem 'test-unit', '~> 1.2.3' if RUBY_VERSION.to_f >= 1.9
gem 'tmail'
gem 'vpim'
gem 'xapian-full'
gem 'xml-simple'
gem 'zip'
Then, follow the instructions to use Bundler with Rails 2.3.
Finally, install the gems and finish setting up Alaveteli. Note that installing the xapian-full
gem may take several minutes.
rvm 1.8.7
gem install bundler
bundle
bundle exec rake db:create:all
bundle exec rake db:migrate
bundle exec rake db:test:prepare