Mac OS X - Snow Leopard installation notes

Added by Redmine User about 8 years ago

Hi,
In case these notes help anybody else trying to install Redmine (1.0.1) on Mac OS X/Snow Leopard (10.6.4).

Originally I had a 32-bit version of mysql (mysql-5.1.47-osx10.6-x86.dmg) installed and I was getting problems at step 5 in the RedmineInstall when running:

sudo RAILS_ENV=production rake db:migrate

Error uninitialized constant MysqlCompat:: MysqlRes

I found that I needed the 64-bit version of mysql. Then, installing the latest (2.8.1) mysql gem resulted in this error when running rake:
Object is not missing constant Issue!

Installing the 2.7 mysql gem seemed to solve this problem.

So, the overall process I found to work at step 5 in the RedmineInstall process:
a) Not sure if this is necessary, but, added to redmine/config/environment.rb

config.gem "mysql" 

after the line:
config.gem 'rubytree', :lib => 'tree'

b) Upgrade mysql from 32-bit to 64-bit (mysql-5.1.50-osx10.6-x86_64.dmg)

c) Uninstall old mysql gem:

sudo gem uninstall mysql

d) Install the 2.7 version of the mysql gem, built to include a 64-bit architecture to work with mysql:

export ARCHFLAGS="-arch i386 -arch x86_64" ; sudo gem install -v 2.7  --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

e) Run rake:

sudo RAILS_ENV=production rake db:migrate

f) Continue the standard install instructions from Step 6:

RAILS_ENV=production rake redmine:load_default_data

g) At step 7, use the _www user and group instead of redmine:

sudo chown -R _www:_www files log tmp public/plugin_assets

h) At step 8, run as sudo (as the tmp directory is now owned by www and you'll otherwise get a _mkdir Permission denied error)

Hope this helps somebody...

Replies (6)

RE: Mac OS X - Snow Leopard installation notes - Added by Matt Connolly about 8 years ago

Very helpful, thanks.

Are you running redmine through webrick? I can run it through webrick but I just can't get cgi or fastcgi or passenger to work....

RE: Mac OS X - Snow Leopard installation notes - Added by Redmine User about 8 years ago

Matt,
I ended up running it through the default OS X (10.6.4) Apache (2.2.14) installation, but not having deployed Rails apps before it was fiddly and I wasn't as diligent taking notes. Below is what I think got me going...

Before starting:
  • My redmine folder is in /Library/WebServer/Documents/
  • I end up being able to access my Redmine installation by going to http://redmine.local/redmine/public (You can probably get rid of the trailing redmine/public by judicious use of sym-links...)

1) Add to /etc/hosts:

127.0.0.1       redmine.local

2) Install passenger:

sudo gem install passenger
sudo passenger-install-apache2-module

Take the output from the installer and put it in /etc/apache2/other/phusion.conf (or passenger.conf may be more sensible). It will be something like:
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.15
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

3) We need to set up a virtual host for our site, so in /etc/apache2/httpd.conf, uncomment the line:

Include /private/etc/apache2/extra/httpd-vhosts.conf

4) Add to /etc/apache2/extra/httpd-vhosts.conf:

<VirtualHost *:80>
    DocumentRoot "/Library/WebServer/Documents" 
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    ServerName  redmine.local
    <Directory /Library/WebServer/Documents/redmine/public>
               AllowOverride All
               Options Indexes FollowSymLinks -MultiViews
               Order allow,deny
               Allow from all
    </Directory>
    RailsBaseURI /redmine/public
    RailsEnv production
</VirtualHost>

5) Add to /Library/WebServer/Documents/redmine/config/additional_environment.rb:

config.gem "mysql" 
config.action_controller.relative_url_root = "/redmine/public" 

6) I think this is only needed after you install plugins (which I did):

sudo RAILS_ENV=production rake db:migrate

7) Stop and restart apache. (If you don't want to use apachectl, uncheck and re-check the Web Sharing checkbox in the Sharing System Preferences panel.)

8) Test it out by going to http://redmine.local/redmine/public in your browser

I spent ages fiddling with this. Google and having:

tail -f /var/log/system.log

tail -f /var/log/apache2/error_log

running in Terminal windows helped nut out some problems.

Good luck...

RE: Mac OS X - Snow Leopard installation notes - Added by Leo Hourvitz about 8 years ago

Just for sharing... I just got redmine up and (apparently) working on Mac OS 10.6 (Snow Leopard). Here were the places I had to vary from the standard install directions, plus my steps for getting Apache+Mongrel installed:

Redmine setup

MySQL

As suggested on the Rails Wiki but differently to User 11's experience above, I did not install the 64-bit version of MySQL, I stuck with the 32-bit version I already had. FWIW, on my system mysql --version shows this:

% mysql --version
mysql  Ver 14.14 Distrib 5.1.45, for apple-darwin10.2.0 (i386) using readline 5.1

The MySQL Gem

As suggested on the Rails Wiki, I made sure to build the gem with the Mac OS X-specific command:

sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Everything else appeared to already be installed.

Locations

I placed my redmine install at /Library/WebServer/redmine-1.0.1. Just for paranoia I didn't use /Library/WebServer/Documents/redmine as above because the default Virtual Host may end up serving all your redmine code files.

The same as User 11, I used the command:

sudo chown -R _www:_www files log tmp public/plugin_assets

instead of the 'redmine' user described in the default install.

At this point the WEBrick server ran, so redmine was pretty much set. Remember to sudo to the _www user so that WEBrick can write the appropriate files:

sudo -u _www ruby script/server webrick -e production

Apache Setup

After reading through the choices, I decided to go for Apache+Mongrel for deployment. I mostly just followed the instructions at http://wiki.rubyonrails.org/deployment/apache-mongrel with the following notes:

Creating the Virtual Hosts

This was the most time-consuming piece.

On Snow Leopard, the main configuration for your Apache2 is in /private/etc/apache2/httpd.conf. The Virtual Host setup sort of is in /private/etc/apache2/extra/httpd-vhosts.conf. To switch over to name-based virtual hosts (sigh, why isn't this the default yet?), you need to migrate any configuration you've done on your main Apache into the first virtual host block in httpd-vhosts.conf.

I'd suggest testing that before proceeding. It's best to always use:

apachectl configtest
sudo apachectl graceful

when editing your config.

Once you have your Apache switched over to virtual hosts and all existing functionality preserved, add a new config file for redmine. I run a number of web apps for development, so I give each app a separate file in other, meaning my redmine file was at /private/etc/apache2/other/redmine.conf. Contents of my file are:

<VirtualHost *:80>
    ServerName  redmine
    DocumentRoot /Library/WebServer/redmine-1.0.1
    RewriteEngine On
    ProxyRequests Off  # This prevents you from becoming an open proxy which is very bad.
    <Proxy balancer://mongrel_cluster>
       BalancerMember http://127.0.0.1:8000 retry=10
       BalancerMember http://127.0.0.1:8001 retry=10
       BalancerMember http://127.0.0.1:8002 retry=10
    </Proxy>

    # PERFORMANCE: If no static file exists, let Mongrel handle the request
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

    <Location />
               Options Indexes FollowSymLinks -MultiViews
               Order allow,deny
               Allow from all
    </Location>
</VirtualHost>

Note: if you've turned on the firewall on your Mac make sure to go open up those three ports.

After the usual configtest/graceful it's back to setting up the mongrel cluster. Here, it was exactly like the Rails Wiki except that when actually starting the cluster, remember to sudo to the same user as the web server so that the mongrel processes can write the appropriate files:

sudo -u _www mongrel_rails cluster::start

RE: Mac OS X - Snow Leopard installation notes - Added by Nirmal Sasidharan about 8 years ago

Great writeup. Thanks a lot.
Wouldn't have managed installing Redmine on MacOSX without this

Nirmal

RE: Mac OS X - Snow Leopard installation notes - Added by Matt Connolly almost 8 years ago

After updating to version 1.0.4, I also needed to run this command:

sudo gem install -v=0.4.2 i18n

Best,
Matt.

RE: Mac OS X - Snow Leopard installation notes - Added by Marin Todorov over 7 years ago

Greatly suggest NOT TO USE MYSQL5.5!!!

try the 5.1 version if 5.5 fails (as it did for me quite many times)

Greetings,
Marin

(1-6/6)