in Rails

Installing Rails on Mac OS X Tiger

2/23/07 update: some things have changed since I wrote this page, either in MacOS itself, or the components referenced. So before you start, be sure to also check a recent update for 10.4.8 and the comments of both pages that contain some valuable information.
If something still does not work, please leave a comment and someone will help you.

I recently Switched back to a Mac, while other long time Mac users are switching to Linux. And I love every minute of it! Once I got the basic stuff going, it was time to install a fitting Ruby on Rails environment on my new iMac.

There are a number of approaches you can use (see the reference section at the bottom). I was after installing an environment as close as one you can use in production, but right here on my desk.

If you are only looking for the basics, Locomotive is probably what you need, if you want a grown-up rails setup on Mac OS Tiger, read on.

Choosing an install method

There are 3 approaches to installing Ruby on Rails on Mac OS Tiger.

You can use the one click approach, and Locomotive is probably the simplest. My main issue is that it is a bit too opaque and if you want to patch anything, upgrade one one the component, you might be out of luck.

You can use the “compile everything from source approach”, and Hivelogic covers this well. This is an approach you might prefer except that you may run into Mac specific issues not covered by typical Unix/Linux code

A third option is to rely on Darwin ports as covered by Evan with “a better way of building ruby, rails, lighttpd, mysql, and postgres on OS X tiger

This third method gets my vote: less opaque, but a large number of smart and dedicated people have already worked out all the problems.

So with that covered, let’s get on with that “grow-up setup” (thanks Coda!). Hmm OK, just one last word of warning before you begin. I’ve installed more than the bare minimum. If you follow these directions, you’ll be all set for standalone lighttpd , standalone mongrel, apache, rails with mongrel and a few more combinations. I haven’t got to using pound just yet, so we’ll keep this for some other time.

Installation on Tiger

If you have not installed Darwin port, now is the time.

Then update port itself

sudo port -d selfupdate

Fix the root path and set the PATH variable in /etc/profile. You may not need this is you are not going to run things as root. Although this will simplify a few things for you.

mate /etc/profile    #fill free to use vi or any other editor you’d like
PATH=”/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin”

Install Apache 2

sudo port install apache2

Create a default configuration for apache

cd /opt/local/apache2/conf
cp httpd.conf.sample httpd.conf

Start Apache

sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.apache2.plist

Rebooting would do the trick too. At this point you should have a “It works!” if you point a browser to http://localhost

Install fcgi (not really going to use it, so it is a just in case so I can benchmark it at some point)

sudo port install fcgi

Install lighttpd

sudo port install lighttpd +ssl

Install mysql 5

sudo port install mysql5 +server

start mysql 5 (you can also reboot)

sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.mysql5.plist

Change the mysql root password (on localhost AND on your network card)

/opt/local/lib/mysql5/bin/mysqladmin -u root password ‘new-password’
/opt/local/lib/mysql5/bin/mysqladmin -u root -h [HOSTNAME] password ‘new-password’

Check it works (empty password if you have not set it)

mysql5 -u root -p

Install subversion

sudo port install subversion +mod_dav_svn +tools

Install ruby and a few goodies

#ruby
sudo port install ruby
sudo port install rb-rubygems
sudo port install rb-termios
sudo port install rb-fcgi
sudo port install rb-mysql5
sudo port install imagemagick

Install Apache mod_fcgi module

sudo port install mod_fastcgi

add the following line to /opt/local/apache2/conf/httpd.conf

LoadModule fastcgi_module modules/mod_fastcgi.so”

Install gems you can’t live without

sudo gem install -y rake
sudo gem install -y rails
sudo gem install -y capistrano
sudo gem install daemons gem_plugin mongrel mongrel_cluster –include-dependencies
sudo gem install rmagick

One good gem to have would be sendfile to avoid copying data between apache and mongrel for example, but the Tiger kernel does not support it despite having the function defined in the C header files. So since it is not really a production machine, we can live without it.

At this point, you’ve got more that the basic setup for Ruby on Rails. That was no too bad, wasn’t it? Although arguably, this could be easier!

Deploying a rails application: Mephisto

For good measure, just to check that our setup is all good, let’s install Mephisto. The latest Rails blog engine.

Create the databases

mysqladmin5 -u root create mephisto_development
mysqladmin5 -u root create mephisto_test
mysqladmin5 -u root create mephisto_production

Checkout everything

svn co http://svn.techno-weenie.net/projects/mephisto/trunk mephisto

Configure the database (should be the right default)

cd mephisto/config
cp database.example.yml database.yml
mate database.example #to check that the database name are what we created

Populate the database

rake RAILS_ENV=production db:bootstrap

And start. Since lighttpd is installed, that’s what it is using

script/server

Point your browser to http://localhost:3000 and yes! It works :D

Or you can go to http://localhost:3000/admin (using admin/test for user/password)

Now let’s finish our “grown up setup” and configure mongrel cluster

mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N3 -c [RAILS_ROOT of mephisto]

a few note on Capistrano

My initial Capistano Cheat Sheet should be enough with one exception. SSH is not enabled by default on Tiger. To enable, use the “Sharing” panel under System Preferences and enable “Remote Login”.

And second, if you have trouble when running via ssh, you may need to fix ssh PATH. To do that, create a file under ~/.ssh/environment with:

PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/bin:/sbin:/usr/bin:/usr/sbin

Run Mongrel Cluster as a service

Now let’s configure Mongrel Cluster to start at boot time

sudo mkdir /etc/mongrel_cluster
ln -s [YOUR RAILS_ROOT]/config/mongrel_cluster.yml /etc/mongrel_cluster/[your application].yml

Create a file ~/Library/LaunchAgents/mongrel_cluster.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Debug</key>
        <true/>
        <key>Label</key>
        <string>org.rails.mongrel.cluster</string>
        <key>OnDemand</key>
        <false/>
        <key>Program</key>
        <string>/opt/local/bin/daemondo</string>
        <key>ProgramArguments</key>
        <array>
                <string>&#8211;label=mongrel_cluster</string>
                <string>&#8211;start-cmd</string>
                <string>/opt/local/bin/mongrel_cluster_ctl</string>
                <string>start</string>
                <string>-v</string>
                <string>-c</string>
                <string>/etc/mongrel_cluster/</string>
                <string>;</string>
                <string>&#8211;stop-cmd</string>
                <string>/opt/local/bin/mongrel_cluster_ctl</string>
                <string>stop</string>
                <string>-v</string>
                <string>-c</string>
                <string>/etc/mongrel_cluster/</string>
                <string>;</string>
                <string>&#8211;restart-cmd</string>
                <string>/opt/local/bin/mongrel_cluster_ctl</string>
                <string>restart</string>
                <string>-v</string>
                <string>-c</string>
                <string>/etc/mongrel_cluster/</string>
                <string>;</string>
                <string>&#8211;pid=none</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/tmp/mongrel.log</string>
        <key>StandardOutPath</key>
        <string>/tmp/mongrel.log</string>
</dict>
</plist>

Additionally, if you did not want to modify /etc/profile, you can add:

    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key><string>/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin</string>
    </dict>

And finally, you can start mongrel cluster. or logging in will work:

sudo launchctl load -w ~/Library/LaunchAgents/mongrel_cluster.plist

To have it work at boot time, you will need to put mongrel_cluster.plist under /Library/LaunchDaemons instead.

References

lighttpd

http://duncandavidson.com/essay/2005/12/railsonlighty

http://duncandavidson.com/essay/2006/01/railsvhostingonlighty

Rails installation

rails with postgres on tiger using Darwin Ports

Lighttpd with rails on tiger

Time For A Grown-Up Server: Rails, Mongrel, Apache, Capistrano and You

Rails installation from single script

Locomotive, one click rails installer for Mac OS X

pound

pound + lighttpd + mongrel

10/17/06 update: I’ve reinstalled on a brand new system with Mac OS 10.4.8. See my notes on what has changed.

51 Comments

  1. Thanks for the info. I also used DarwinPorts. My issue is the lag time. There’s a new version of RMagick that depends on a new version of Ruby Gems to be installed. One can, of course, update installed gems using port with no problem, but believe I need to have DarwinPorts install Ruby Gems for me and, while they current version is 0.9.0, the port is still at 0.8.11. Do you have any idea how much port lags for releases or how to build more up-to-date version of libraries than are managed by DarwinPorts? Thanks again – Scott

  2. Nice tutorial. I have hardly any experience in Rails and hadn’t seen Locomotive before so thanks to the link for that as well!

  3. Scott,

    one nice feature of Darwin Ports is that you can easily install/uninstall/activate/deactivate components. See http://www.darwinports.org/docs/ch02s04.html for more details.

    So if a more recent version is not available, you can always resort to compiling from sources directly.

    And check out this post: http://poocs.net/articles/2005/07/06/making-rmagick-suck-less-with-tiger#meat

    As far as tweaking a darwin port myself, I haven’t tried yet, but it seems the above link my be a start.

    James,
    Locomotive is a great way to get you going!

  4. Hivelogic shows you how to do this without darwin ports

  5. Adam, indeed, if you’d rather build everything, Hivelogic is a good reference (listed in the References section under “Lighttpd with rails on tiger”). I prefer the flexibility of Darwin Ports for switching versions around. Although it it fairly easy to tweak a darwin port and I’m working on a post to be released shortly. This should also be of interest to Scott I believe

  6. In your ~/.ssh/environment hint, you will also want to ensure that
    /etc/sshd_config has ‘PermitUserEnvironment’ set yes.
    If it doesn’t, you need to define it and send HUP to sshd process.
    Otherwise ssh will appearantly ignore your ~/.ssh/environment

  7. Juha, this tip may be helpful to some. For some reason, this has not been something I needed though.

  8. Anyone have a strategy now that OpenDarwin.org has been axed?

  9. do you know when macports will be active so i can install this?

  10. rcpetersen@twmi.rr.com

    I cannot get past the msqld.sock problem. I did note that the eariler coomands needed a path change, in a couple places, from ‘darwinports’ to ‘make ports’

    are their additional changes to be made?

    Thanks,
    bob

    PS Command ad erroer follow…..

    $ /opt/local/lib/mysql5/bin/mysqladmin -u root password ‘f42*A’

    /opt/local/lib/mysql5/bin/mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Can’t connect to local MySQL server through socket ‘/opt/local/var/run/mysql5/mysqld.sock’ (38)’
    Check that mysqld is running and that the socket: ‘/opt/local/var/run/mysql5/mysqld.sock’ exists!
    robert-petersens-computer:~ rp$

  11. Did you confirm that mysqld is running?

    Here’s what I get:

    $ ps ax|grep mysql
    33 ?? Ss 0:00.02 –label=mysql5 –start-cmd /opt/local/etc/LaunchDaemons/org.darwinports.mysql5/mysql5.wrappe
    71 ?? S 0:00.02 /bin/sh /opt/local/lib/mysql5/bin/mysqld_safe –datadir=/opt/local/var/db/mysql5 –pid-file=
    90 ?? S 9:48.51 /opt/local/libexec/mysqld –basedir=/opt/local –datadir=/opt/local/var/db/mysql5 –user=mys
    7164 pd R+ 0:00.00 grep mysql

    If it is running, then try searching for mysqld.sock (if locatedb has been updated, you can use

    locate mysqld.sock

    which should return

    /opt/local/var/run/mysql5/mysqld.sock

    You should also confirm that launchd is configured to run mysql5 a startup:

    sudo launchctl list

    and your should see __org.darwinports.mysql5__

    Rebooting might help as well. A few more things would be to start mysqld by hand and check that it stays up.

    And one last thing, could you have an other installation of mysql on the same port that is still running, and using a different socket path?

  12. rcpetersen@twmi.rr.com

    ps ax|grep mysql only lists the first line, the org.darwinports.mysql5 is listed as org.macports.mysql5

    mysqld.sock originally did not exist, but touch mysqldsock was run to create it

    sudo launchctl list has org.macports.mysql5 and org.macports,apache2

    What do I do next? Was mysql install channged to macports for a reason and are there other changes that need to be made as a work around. Or do I need to remove it and install an earlier version? If so how is that done?

  13. Also, ther was no other mysql installed, unless apple has it hidden somewhere. The /usr/local directory does not exist on my machine. Let me know if it is somewhere else.

    I did launchctl unload and noticed when I reloaded it I get another error: rp$ Workaround Bonjour: Unknown error: 0. I ignored it earlier, is it actually indicattive of something else that needs to be done.

    PS Thanks for all your efforts. I have been in software a long time, but this is my first attempt at something on an Apple. Also my first attempt at Ruby & rails. It was my enjoyment in working in Smalltalk that attracted me to R&R. Your site was by far the most simple and straightforward to follow.

  14. I am also new to mysql! After reading the manual i ran:

    >sudo mysql\_install\_db5 –user=mysql
    >sudo mysql_safe5 –user=mysql &

    resulted in [5] 5217, is ths correct?
    continue on…..

  15. The error with Bonjour is harmless (as best I can tell and I think I got this as well).

    I dont’ recall having to run “mysql\_install\_db5″. I would think the installer had done it.

    check the permissions of /opt/local/var/run/mysql5/ make it world writable just to be sure (chmod ugo+w)
    what’s in your /etc/my.cnf? (not sure where it is exactly as I’m not in front of a mac now)

    Creating the socket with touch is not going to work. It doesn’t create a file with the right type (regular file vs socket).
    That socket is created by mysqld when it starts and removed when it stops.

    if “ps ax|grep mysql” only list the first line, it means that mysql is started and then dies.
    Stop what’s running (kill -9) and try (no ampersand, and add a 5 if needed)

    mysqld_safe –user=mysql

    Does it stop right away?

    I think the errors go into /var/log/system.log (not at my machine now).

    Smalltalk? Cool. Tried it for a bit back when I was in school!

  16. Smalltalk was a decade ago or so, but loved learning th OO & MVC paradigms on it. Found it easy to think conceptually and immediately code it. Excellent for rapidprototyping back then. To bad it didn’t catch on. Hoping R&R pick up the torch.
    mysql appears to be running! However, donot know what to put in for [HOSTS] on the second password command, Used P1.local and get the error
    >/opt/local/lib/mysql5/bin/mysqladmin: connect to server at ‘P1.local’ failed
    >error: ‘Host ‘192.168.2.150’ is not allowed to connect to this MySQL server’
    skipped that and got on to
    >sudo gem install -y capistrano
    and had a notifications, for example
    >lib/net/ssh/transport/ossl/hmac/services.rb:31:63: Skipping require of dynamic string: “net/ssh/transport/ossl/hmac/#{name}”
    l>ib/net/ssh/transport/ossl/hmac/services.rb:31:63: Skipping require of dynamic string: “net/ssh/transport/ossl/hmac/#{name}
    Are they important?

  17. What did you do to make it run?

    by default, only root can connect from _localhost_ (use that for HOST) use things like:

    mysql5 -u root
    mysqladmin5 -u root

    And if you did set a password for root, add __-p__.

    One more thing: in your database.yml, you’ll probably need a line with:

    socket: /opt/local/var/run/mysql5/mysqld.sock

    so that rails can find mysql

    The error with net/ssh should be harmless, and if I’m not mistaken, is reported by rdoc.

    I played with smalltalk about 20 years ago, on a PC, and that was a bit too slow to do anything practical. Lots of interesting concepts, though.

  18. -DIDNOT add socket:… , see previous note above, to beginning of mysql.yml
    -Added /opt/local/lib/mysql5/bin to .profile PATH
    -Executed the following

    sudo launchctl unload -w /Library/LaunchDaemons/org.macports.apache2.plist
    sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
    sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist
    sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
    sudo launchctl list #to verify apache2 and mysql5 are in startup list
    mysqladmin -u root -h localhost password ‘pwd’ -p
    sudo launchctl list #reports org.macports.mysql5 and org.macports.apache2 in the list
    -restart from the apple menu
    ps ax|grep mysql reports properly

    Note:
    creating mephisto directories need to use -p argument

    Outstanding issues:
    Mephisto install failed at

    rake RAILS_ENV=production db:bootstrap
    # (in /opt/local/mephisto)
    rake aborted!
    undefined method `autoload_paths’ for #
    (See full trace by running task with –trace)

    What do I do next?

    locate does not work on my machine, what needs to be added to get that functionality?

  19. Sorry for the mess! How does one get the nice boxes in the other messages?

  20. from the installling mephisto page need to add Edge Rails and tzinfo gems, which are not requred by mephisto

    cd /opt/local/mephisto
    svn update
    sudo rake rails:freeze:edge
    sudo gem install tzinfo –remote
    sudo chmod 0666 /log/production.log
    cd /opt/local/mephisto/config
    sudo rake RAILS_ENV=production db:bootstrap –trace

    The trace has, hopefully, one last error

    /opt/local/mephisto/config xx$ sudo rake RAILS_ENV=production db:bootstrap –trace
    (in /opt/local/mephisto)
    ** Invoke db:bootstrap (first_time)
    ** Execute db:bootstrap
    mkdir -p /opt/local/mephisto/config/../log
    ** Execute environment
    ** Execute db:schema:load
    — create_table(“assets”, {:force=>true})
    rake aborted!
    Access denied for user ‘root’@’localhost’ (using password: NO)
    … rest of trace ok …

    What needs to be done to setup the root@localhost password?

  21. Bob, did you mean to say: …tzinfo gems, which are *now* required?

    Did you do this bit to set the password?

    /opt/local/lib/mysql5/bin/mysqladmin -u root password ‘new-password’

    Set the password to any value you’d like and then specify that value.

  22. Figured out the issue above. and now have new error.

    From the URL http://mephisto.stikipad.com/help/show/Installing+Mephisto

    “Mephisto requires several gems, most of which are included. However, the following gems are also required, but not
    included:
    Edge Rails
    tzinfo gems”

    Ran the following sequence ok till last line:

    cd /opt/local/mephisto
    svn update
    sudo rake rails:freeze:edge
    sudo gem install tzinfo –remote
    cd /opt/local/mephisto/config
    sudo rake RAILS_ENV=production db:bootstrap
    sudo script/server

    Start server

    sudo script/server
    => Booting Mongrel (use ‘script/server webrick’ to force WEBrick)
    => Rails application started on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server

    In browser use URL http://localhost:3000/, which results in ERROR:

    ** Starting Mongrel listening at 0.0.0.0:3000
    ** Starting Rails with development environment …
    ** Rails loaded.
    ** Loading any Rails specific GemPlugins
    ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
    ** Rails signals registered. HUP => reload (without restart). It might not work well.
    ** Mongrel available at 0.0.0.0:3000
    ** Use CTRL-C to stop.
    127.0.0.1 – [Sat, 16 Sep 2006 01:48:38 GMT] “GET / HTTP/1.1″
    127.0.0.1 – [Sat, 16 Sep 2006 01:48:39 GMT] “GET /favicon.ico HTTP/1.1″
    DEPRECATION WARNING: observer is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details. (called from at ./script/../config/../app/controllers/mephisto_controller.rb:5)
    DEPRECATION WARNING: depend_on is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details. (called from observer_without_deprecation at ./script/../config/../vendor/rails/actionpack/lib/action_controller/deprecated_dependencies.rb:29)

    Processing MephistoController#dispatch (for 127.0.0.1 at 2006-09-15 21:48:39) [GET]
    Parameters: {“action”=>”dispatch”, “controller”=>”mephisto”, “path”=>[]}
    Site Columns (0.000000) Mysql::Error: Table ‘mephisto_development.sites’ doesn’t exist: SHOW FIELDS FROM sites
    ActiveRecord::StatementInvalid (Mysql::Error: Table ‘mephisto_development.sites’ doesn’t exist: SHOW FIELDS FROM sites):
    .//vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:122:in `log’
    .//vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:187:in `execute’
    .//vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:295:in `columns’
    .//vendor/rails/activerecord/lib/active_record/base.rb:759:in `columns’

    What is deprecation? What needs to be done to correct or is it something that shouldn’t be worried about?

    Why does the table mephisto_development.sites not exist? What needs to be done to avoid that message or should it be ignored?

  23. Bob,
    first of all, sorry about the delay replying. Your comments get caught by the spam filter, and it has been a few days till I checked.

    In any case, don’t worry about the “deprecation” messages. These are things that will eventually be removed from rails but are still fine to use today.

    it looks like you created “production” tables, but it is trying to access mephisto_development, which is most likely not created.

    You could either create it by using:

    rake db:bootstrap

    by defaull it will create the tables for development, or you can force mongrel to use the production environment by forcing RAILS_ENV=production in config/environment.rb

  24. First of all, thanks a lot for this clear step by step guide. However I’m getting an error when running rake to populate the db and hope you could help me out. Following is the error:

    paris:~/Projects/mephisto thaiger$ rake RAILS_ENV=production db:bootstrap
    (in /Users/thaiger/Projects/mephisto)
    mkdir -p /Users/thaiger/Projects/mephisto/config/../log
    rake aborted!
    undefined method `alias_method_chain’ for #
    (See full trace by running task with –trace)
    paris:~/Projects/mephisto thaiger$

    Thanks

  25. Oops, the error message did not get escaped; here it goes again:

    paris:~/Projects/mephisto thaiger$ rake RAILS_ENV=production db:bootstrap
    (in /Users/thaiger/Projects/mephisto)
    mkdir -p /Users/thaiger/Projects/mephisto/config/../log
    rake aborted!
    undefined method `alias_method_chain’ for #
    (See full trace by running task with –trace)
    paris:~/Projects/mephisto thaiger$

  26. Hey – after cleaning up my mess from flipping from hivelogic to macports, I think I’m ok.

    The only thing I _don’t_ get is the mongrel_cluster setup; how exactly do I get this thing to serve from port 3000 to using apache2?

    Any help GREATLY appreciated.

  27. In trying to be brief, I left out a few details about the apache2 configuration. You can can the details from [codahale.com](http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)
    The important part is

    # Redirect all non-static requests to cluster
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

    and this bit

    It seems that you’ll get better result using [pound](http://mongrel.rubyforge.org/docs/pound.html) or [nginx](http://wiki.codemongers.com/NginxRubyonRailsMongrel) in front of your mongrels cluster. [pen](http://mongrel.rubyforge.org/docs/pen_balance.html) can also be an option. From the [benchmarks](http://blog.kovyrin.net/2006/08/28/ruby-performance-results/) I’ve seen, nginx is your best bet.
    Hope this helps!

  28. Total nub, but wouldn’t I need to include the refernce to apach (/opt/local/apache2/bin) in the very first edit of /etc/profile?
    Thanks for a response. walt@nsitedesign.com

  29. adding /opt/local/bin to the default path is to allow any executable that the maintainers of each port deemed useful to be in the regular path to be run as is.
    In specific instances, you may want more and you can either add entries to the path, or add links in /opt/loca/bin for what you want.
    In the case of apache, I haven’t I needed to to that, but that’s up to you.
    The launchtl script won’t need more in the path for example.

  30. You must do a
    rake rails:freeze:edge
    do get the latest rails otherwise mephisto will not work,,,,

  31. That’s correct, at least for a bit longer. Once Rails 1.2 is out (which should be any day now), Mephisto will use it. Till then you need edge.

  32. Pascal, thanks for the great overview! I just configured RoR on a new mac yesterday (2007-01-28) using this as a guide, and have some notes for things you might want to update:
    * First of all, if you’re installing on a brand new machine, make sure to install X11 from the Tiger install disc, otherwise the ImageMagick step starts to download and build XFree86…
    * There’s a Darwin port link which is a direct link to the dmg for 1.2.1… either point to the latest dmg, or only to the homepage or download page
    * In the *Create a default configuration for apache* section, the line containing the *cp* command needs a sudo in front
    * in the *Start Apache* section, for the *launchctl* command, change org.darwinports to org.macports
    * after installing mysql5, be sure to heed the warning about running the database creation option for a new installation! If you don’t do that, you’ll run into a series of headaches as mysql mysteriously won’t run…
    * in the *start mysql* section, for the *launchctl* command, change org.darwinports to org.macports
    * instructions say to installe the *rb-mysql5* ports package, but that seems to be gone. Use *rb-mysql* instead.

    I went a bit further, enough to find that Mephisto now doesn’t quite run “out of the box” with these instructions, but didn’t investigate further since I’m not using Mephisto anyway.

    Thanks again, your walkthrough shows very clearly how to best install RoR the “ports way”.

  33. Thank you for taking some notes while installing. I’m this will be helpful for others. Plus it is hard for me to do another “totally from scratch” install.

    I did a refresh about 3 months ago (http://blog.nanorails.com/articles/2006/10/17/installing-rails-on-mac-os-x-tiger-10-4-8) but it looks some of that is even outdated.

    And mephisto has evolved quite a bit since I wrote this. It should be fairly straightforward, though. Create a database, do rake db:boostrap and that’s it (if you use rails 1.2.1 now)

  34. Jimmy,

    thank you for pointing that out. Even though it was not necessary at the time I wrote this, it is now and I’m glad you found it and got it going. This page is due for an update and having created an other page was not such a good idea. I should just have updated this page instead. Jack already provided some valuable updates as well.

    To safely update these instructions, I need a brand new Mac :)
    Although reinstalling a system on a new drive might do.

  35. Pascal: How did you know how to write the plist file? Do you know how for Thin? (A sort of fork for mongrel).

  36. Ecchi,

    most of it is a wrapper for daemondo, which itself is a thin wrapper to make any command work as a daemon as long as you have a command to start and stop.

    So if Thin is a fork of Mongrel, I would imagine you should not be too far away from, and may just work as it (I’m not familiar with Thin).

    And I don’t think Tiger or Leopard should matter in this case.

  37. Well I’m pretty positive I’ve got it setup properly (the plist). The problem I keep getting on sudo launchctl load -w ~/Library/LaunchAgents/thin.plist

    launchctl: Dubious ownership on file (skipping): ~/Library/LaunchAgents/thin.plist

  38. Yes, its my user. I found -F instead of -w seemed to load it, but the plist just isn’t launching on boot/login. Here’s my current plist:
    http://pastebin.ca/922156

    manually typing the following into terminal works perfectly fine, but apparently my settings adaption into a plist isn’t right:
    /opt/local/bin/daemondo—label=thin—start-cmd /usr/local/bin/thin start -s 3 -C /etc/thin/thin.yml—pid=none

    (my ruby/rails stuff is in /usr/local because I compiled it manually, instead of using macports).

  39. Maybe the environment is different and it fails quickly. Enable/check as much logging as you can (Including the system log). Increase daemondo’s verbosity level.

    Something is bound to come up

  40. awesome stuff!
    Im Tiger user, but i cant found my mysql plist file inside the library path as you told above. i’ve succesfully installed mysql5 port, btw.

    could somebody help me to start mysql server, pls?

    thanks in advance.

  41. Well, you need to create a plist file for mysql. None exists before you do.
    You can also start mysql just by starting mysqld, but it will not get restarted each time you boot.

    In fact, this also applies to leopard.

Comments are closed.