Home > Life and times of Jacken, Technical stuff > GTD, Ruby on Rails and the Mac

GTD, Ruby on Rails and the Mac

There’s been a lot of buzz on the internet about a method to Getting Things Done. I use an simple and elegant solution called Tracks. It’s made in Ruby on Rails, so to set it up can be a pain for the more technically challanged. Here’s a quick tutorial on how to set it up using Locomotive. No terminal commands needed!

Here’s what you need:

Download Locomotive. It’s a one-click solution for Ruby on Rails on Mac OS X. No funky command line commands. Install it in your Application folder as usual.

Download Tracks. Unpack it and move the tracks folder to you Document folder. Go into the config folder inside the Tracks directory you just copied. Make duplicates of the files database.yml.tmpl and environment.rb.tmpl, and rename them database.yml and environment.rb.

Open the file database.yml and replace all text in there with the following lines:

development:
  adapter: sqlite3
  database: ~/Documents/tracks-1.041/db/tracks-104.db

test:
  adapter: sqlite3
  database: ~/Documents/tracks-1.041/db/tracks-104.db
 
production:
  adapter: sqlite3
  database: ~/Documents/tracks-1.041/db/tracks-104.db

Save the file.

Update: A lot of people have had problems with error messages like “Internal Server Error -500″ With .yml files you have to be very careful about formatting. Make sure that the config lines are indented with the same amount of spaces.

Or you could download a pre-prepared database.yml here.

Make a copy of the file environment.yml.tmpl in the config directory and rename the copy environment.yml

Make a copy of the directory called log.tmpl and change the name of the copy to log.

Now start Locomotive. When you get to the main screen, click on the plus sign at the lower left corner of the window.

Select “Add existing”

Add existing

You can now add en existing Rails Application, which in this case is Tracks. So press the Choose button, and select the Tracks folder. Leave the port number to the default 3000.

Leave the rest of the settings to default values. Locomotive settings

Press the Add button.

You should now have your Tracks application in the list.

Time to do the last changes. Select Tracks in the main window. Press the Info button in the toolbar.

Locomotive Info button

Change the run mode to Production. Leave the rest of the settings.

Locomotive info settings

Now close the settings window.

You should now be able to press the Run button. If everything works, there should be a green light to show that the application is up and running.

Start a web browser and point it t

o http://127.0.0.1:3000/signup

Voila! Tracks!

Make sure to check the little checkbox in Locomotive so that Tracks starts automatically when launching Locomotive. Now the only thing you need to do to use Tracks is to start Locomotive. Even when your not online.

All of your Tracks data is contained in your Tracks folder. So all you need to do for backup is to copy the whole folder. Simple and easy.

If you liked this story, please Digg it!

[eminimall]

  1. Chris
    May 27th, 2006 at 04:13 | #1

    Hello,

    great walkthrough! Unfortunately just after completing installing and setting up everything, I get a “500 – Internal Server Error” when trying to log in for the first time while going to http://127.0.0.1:3000/signup. How can I fix this?

    Thanks, Chris

  2. Jacken
    May 27th, 2006 at 09:03 | #2

    You could check the log. In the Tracks folder there’s a folder called log. Double-click on production.log. This should open the console program and show you the log. Check for error messages…

  3. Chris
    May 27th, 2006 at 14:58 | #3

    Hi,

    the production.log itself is empty with no error messages. I checked the other log files in the tracks folder and here are some error messages that might indicate the problem: I checked the lighttpd.error.log and that is what comes up:

    2006-05-27 14:48:23: (log.c.75) server started 2006-05-27 14:48:27: (log.c.135) server stopped 2006-05-27 14:48:29: (log.c.75) server started 2006-05-27 14:48:54: (modfastcgi.c.2430) unexpected end-of-file (perhaps the fastcgi process died): pid: 9953 socket: unix:/tmp/ruby-fastcgi.pnkhz.socket-1 2006-05-27 14:48:54: (modfastcgi.c.3168) child exited, pid: 9953 status: 1 2006-05-27 14:48:54: (mod_fastcgi.c.3215) response not received, request sent: 1023 on socket: unix:/tmp/ruby-fastcgi.pnkhz.socket-1 for /dispatch.fcgi , closing connection

    Could it be a database error? Unfortunately I do not understand much about Ruby on Rails, let alone databases. I just wanted to try out Tracks.

    Any suggestions? Thank’s a lot for your help!

    Chris

  4. Chris
    May 27th, 2006 at 15:43 | #4

    Or could it be as simple as having to restart the machine before being able use Tracks?

  5. Leon
    May 28th, 2006 at 09:53 | #5

    I have the same problem but with this in the log:

    Could not find pid file: /Users/leonpereiraphd/tracks-1.041/log/locomotive.pid (TerminateApp::PidFileMissingError)

  6. Jacken
    May 28th, 2006 at 11:19 | #6

    Put the tracks folder in your Documents folder. Change the database.yml to reflect that. For example:

    production: adapter: sqlite3 database: ~/Documents/tracks-1.041/db/tracks-104.db

    Note: I tried to put it in the desktop folder but then I got Internal server error 500.

  7. Chris
    May 28th, 2006 at 14:57 | #7

    Hi,

    sorry I still get a 500 Internal Error even when putting the tracks folder in Documents and adjusting database.yml and adding the new tracks folder to Locomotive.

    I now tested it both under my daily account and my admin account. Same behavior.

    What can I do?

  8. Jacken
    May 28th, 2006 at 17:03 | #8

    I found the problem! yml files are very perticular about spacing. I managed to mess up the text when adding it to my posting. You can now download a pre-prepared database.yml (see link in text above)

    This should fix it.

    Jacken

  9. Chris
    May 28th, 2006 at 21:24 | #9

    Hi Jacken,

    now it works! Awesome – thanks a lot! Thanks for your great work!

    Best regards, Chris

  10. June 9th, 2006 at 18:04 | #10

    I am stuck at your instruction “Make a copy of the file environment.yml.tmpl in the config directory and rename the copy environment.yml”. There is no such file in the config directory of the distribution I downloaded (tracks-1.041).

    Thanks Alex

  11. June 9th, 2006 at 18:18 | #11

    I found the problem. Although there was no environment.yml.tmpl in config, the real problem seemed to lie with database.yml. Expanding the tilde to full path fixed it.

    Thanks for the walkthrough though. It made it almost too easy. Alex

  12. Paul McCann
    June 10th, 2006 at 14:02 | #12

    Nice work! As Alexandre notes, the image of the Locomotive “Add existing” screen should have

    ~/Documents/tracks-1.041

    instead of “~/tracks-1.041″, and the environment.yaml.tmpl is definitely awol (but ignoring it does no harm). With those changes everything’s really smooth; thanks very much for the instructions,

    Paul

  13. Mark
    June 11th, 2006 at 21:01 | #13

    When I try to open database.yml it says there is no default application to open that file asks me what to choose an application to use. What should I do? Thanks.

  14. Jacken
    June 12th, 2006 at 00:21 | #14

    You need a text editor. Download TextWrangler (free) or my favorite TextMate.

  15. Mark
    June 12th, 2006 at 04:57 | #15

    Thanks. Now when I go to http://127.0.0.1:3000/signup, Safari says that it can’t connect to the server.

  16. Sybil
    June 13th, 2006 at 23:36 | #16

    I’m having the same problem (or a similar problem). I’ve carefully followed all directions including the advice about spacing in the database.yml file, and Tracks does seem to run in Locomotive, but when I go to the signup address I get a 500 error message. I have tried Firefox and Safari (but I don’t think the browser is the problem). I am running OS X 10.3.9 FWIW.

    In desperation I also installed Ruby and Rails and all the other bits by hand, meticulously following the directions, including a fresh install of Xcode and MySQL, and tried to run Tracks that way, and the same error message showed up. So I’m wondering if this isn’t a more subtle bug.

  17. Mark
    June 28th, 2006 at 02:16 | #17

    I still can’t connect to that url. I get this message : Safari can’t open the page “http://127.0.0.1:3000/signup” because it could not connect to the server “127.0.0.1”.

    Any thoughts?

    Thanks.

  18. Jacken
    June 28th, 2006 at 07:58 | #18

    Mark: Try to connect to http://0.0.0.0:3000/signup instead.

  19. June 28th, 2006 at 19:32 | #19

    I have Tracks set up in a hosted arrangement eliminating the need to go through the motions of a local installation. I will be opening this up to the public and making enhancements. In the meantime, if you would like a free ‘beta’ Tracks account to use for personal use or demo purposes please send an email to brightpoolatgmail.com (Edit for spam.) and include the username you would like assigned to you. You will be emailed back promptly with a password and login instructions. Thanks!

    -Kevin

  20. July 16th, 2006 at 21:49 | #20

    hi! i’m also hosting Tracks for free at: http://tracks.tra.in

    you can go ahead and sign up without having to email me. i started out using locomotive (after reading this blog post) locally, but then wanted to be able to access Tracks from anywhere. then i enabled open signups.

    i also made some slight feature/design tweaks and have more ideas (like a more gmail-esque interface), though it’s pretty nice ‘n’ elegant already.

    hope this helps!

  21. July 22nd, 2006 at 17:57 | #21

    I get a stacktrace (NoMethodError in Login#signup). This is sooo annoying; it also happens with an SVN checkout.

    Doubly annoying.

  22. Luis Bruno
    July 22nd, 2006 at 18:05 | #22

    The problem for those who go to /signup and get a NoSuchMethod exception is “fixable”:

    sqlite3 ~/Documents/tracks-1.041/db/tracks-104.db ‘delete from users;’

    It’s a bug, but I’m no Rubyist; I’ll check bsag’s Trac and drop him a ticket.

  23. July 24th, 2006 at 18:54 | #23

    I’ve built on the instructions above and added some instructions for using mySQL instead of sqllite. Inlcuded is a SQL script for setting up the db and tables: http://www.mikekrisher.com/2006/07/using-rails-app-tracks-with-mysql.php

  24. myrcurial
    August 2nd, 2006 at 04:46 | #24

    @Leon: make sure there’s a log folder inside the tracks folder (mine didn’t have one) and that should solve the PID problem.

  25. Christian
    August 18th, 2006 at 14:05 | #25

    I get “could not open database” and a lot more text when I go to the browser. Did I miss a step? Or do I have to ‘turn on’ the database?

  26. Gatito
    August 19th, 2006 at 03:52 | #26

    I am also getting a “could not open database” error. Here are the first two lines of the error report that appears on the browser window:

    could not open database /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/errors.rb:94:in

    check'
    /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:112:in
    initialize’

    Is this an issue that only affects the new version of locomotive or tracks? I am trying to install it in a Macbook.

  27. Thalia
    August 19th, 2006 at 14:34 | #27

    I was also getting the “could not open database” error and replaced Documents/tracks-1.041 in the yml file with Documents/tracks_1.042 – seems to work now

  28. Gatito
    August 19th, 2006 at 20:41 | #28

    Thalia, that was elegantly simple and beautiful. I’m now on track, sort of speak. =)

    Thx Jacken for this wonderful article.

  29. Christian
    August 28th, 2006 at 13:35 | #29

    Replacing didn’t't seem to work for me but instead I found a Rails server, so Tracks is working for me now.

  30. August 28th, 2006 at 13:57 | #30

    Hi,

    doesn’t work for me: I have carefully changed all the text lines to my path (/Documents/tracks_1.042/db/tracks-12.04.db) but still get the “could not open adatabase” error.

    Any further suggestions? If it stays as complicated just to have a look at tracks its not for me… Still would love to have a try.

    Greetings, Rolf

  31. Christian
    September 5th, 2006 at 13:33 | #31

    Rolf – you can try it at http://tracks.brightpool.com/login

  32. October 11th, 2006 at 20:03 | #32

    I am running 1.043 on a Macbook pro and get the server error on 127.0.0.1 and 0.0.0.0. I have changed the db file in the config to reflect 1.043 and have the file in the docs folder. Any suggestions? Any changes in 1.042 or 1.043 that render the instructions in accurate? Perhaps something in my browser settings (I’ve tried both firefox and safari.

    Thanks!

  33. Bob
    October 29th, 2006 at 02:46 | #33

    I don’t have these files in my config directory: environment.yml.tmpl, log.tmpl.

  34. Terry
    October 30th, 2006 at 03:44 | #34

    The comments of others were great in getting tracks up and running in Locomotive. However, now I’ve found a coincident problem. I’m not sure it’s related in anything except time. Here goes – my Chronos SOHO Notes has quit working. Well quit is too strong. It no longer finds its related Openbase database. It now tries to connect to 127.0.0.1 and when it cannot find the database there reports that fact and quits. So Notes tries to connect to the database, then tries to create the database, and failing at both, quits. Has anybody else run into database or database location conflicts?

  35. October 31st, 2006 at 00:51 | #35

    Bob, I don’t have either..

  36. Martin
    January 9th, 2007 at 13:06 | #36

    If you do download the database.yml file, it is out of date regarding the version of Ruby you will install. So, first thing you must do is change that from

    production: adapter: sqlite3 database: ~/Documents/tracks-1.041/db/tracks-104.db

    to

    production: adapter: sqlite3 database: ~/Documents/tracks-1.043/db/tracks-104.db (or whatever version of tracks is in the Documents folder.

    In spite of all this, I still had the internal error 500, but stopping Locomotive and restarting it solved it.

  37. Ray
    January 24th, 2007 at 07:32 | #37

    I just installed everything and followed the directions and I’m also getting the dreaded “Can’t connect to server at 127.0.0.1:3000. I did make sure the database.yml file was updated to reflect the new folder name for tracks.

    The production.log file is empty, not showing any errors.

    Any suggestions?

    Thanks, Ray

  38. Ray
    January 24th, 2007 at 08:02 | #38

    An update. I did a little investigating and it looks like the january version of Locomotive has problems, so if you go find your config/locomotive.yml file and add this line to the end:

    server: lighttpd

    You won’t get any further “can’t connect to server” errors, at least in my case and a few others.

    Now my problem is finding the database – I’m getting the following errors: Any suggestions?

    could not open database: unable to open database file /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.0/lib/sqlite3/errors.rb:94:in

    check'
    /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.0/lib/sqlite3/database.rb:112:in
    initialize’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/activerecord/connectionadapters/sqliteadapter.rb:17:in
    new'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:17:in
    sqlite3
    connection’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/activerecord/connectionadapters/abstract/connectionspecification.rb:251:in
    send'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in
    connection
    withoutquerycache=’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/activerecord/querycache.rb:54:in
    connection='
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in
    retrieveconnection’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/activerecord/connectionadapters/abstract/connectionspecification.rb:78:in
    connection'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/active_record/base.rb:696:in
    columns’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/activerecord/base.rb:704:in
    columns_hash'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb:103:in
    setup
    sessidcompatibility!’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/actioncontroller/session/activerecordstore.rb:77:in
    find_by_session_id'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb:281:in
    initialize’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/activerecord/lib/activerecord/base.rb:794:in
    silence'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb:281:in
    initialize’ /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/1.8/cgi/session.rb:273:in
    new'
    /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/1.8/cgi/session.rb:273:in
    initialize’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action
    controller/cgiprocess.rb:111:in
    new'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:111:in
    session’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action
    controller/cgiprocess.rb:141:in
    stale_session_check!'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:107:in
    session’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action
    controller/base.rb:885:in
    assign_shortcuts_without_flash'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/flash.rb:141:in
    assignshortcuts’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/actioncontroller/base.rb:373:in
    process_without_filters'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/action_controller/filters.rb:364:in
    processwithoutsessionmanagementsupport’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/actionpack/lib/actioncontroller/sessionmanagement.rb:117:in
    process'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in
    dispatch’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/railties/lib/fcgihandler.rb:150:in
    process_request'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:54:in
    process!’ /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in
    each_cgi'
    /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
    each’ /Applications/Locomotive2/Bundles/standardRailsJan2007.locobundle/powerpc/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
    each_cgi'
    /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:53:in
    process!’ /Users/Solari/Documents/tracks-1.043/public/../config/../vendor/rails/railties/lib/fcgi
    handler.rb:23:in `process!’ /Users/Solari/Documents/tracks-1.043/public/dispatch.fcgi:24

  39. Ray
    January 24th, 2007 at 08:51 | #39

    Okay, I did some more investigating… I found out if I downloaded an earlier version of Locomotive (2.02), everything started working… With tracks 1.4.3.

    Dunno why the database won’t connect under 2.08 of Locomotive.

    Hope this helps some of you.

    Ray

  40. Phil
    February 3rd, 2007 at 17:00 | #40

    As Ray indicated, it won’t work with 2.0.8 Locomotive “out of the box”. Tracks appears to be incompatible with Rails 1.2.1+ so you just need to download the RMagickRailsSep2006 bundle for Locomotive from here (under the Bundles section):

    http://sourceforge.net/project/showfiles.php?group_id=146941

    …and place the bundle in the “Bundles” directory (this dir is in the same dir as the Locomotive.app). Then when you create your tracks loco entry, select “RMagick Rails Sep 2006″ in the drop down to use an older version of Rails. This got me up and running with the rest of the instructions above.

    Thanks for the tutorial!

  41. Phil
    February 3rd, 2007 at 17:06 | #41

    Oh, forgot one more thing I had to do… the ‘boot.rb’ file in the /config directory has a reference to railties which I had to remove for the application to start. I changed my boot.rb to look like this (basically commenting out the “if”):

    if File.directory?(”#{RAILS_ROOT}/vendor/rails”)

    require “#{RAILS_ROOT}/vendor/rails/railties/lib/initializer”

    else

    require ‘rubygems’ require ‘initializer’

    end

    ..it seems that Tracks 1.0.43 expects railties to be in the /vendor/rails dir, but its not included in the Zip file.

  42. Phil
    February 3rd, 2007 at 17:17 | #42

    Well, since the comment formatting blitzed my code, I’ll try one more time… at the bottom of the boot.rb file, I did this:

    
    
    #if File.directory?("#{RAILS_ROOT}/vendor/rails")
    #  require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
    #else
      require 'rubygems'
      require 'initializer'
    #end

    If it fails miserably again, just comment out the first 3 lines (”if”, “require”,”else”) and the associated “end” (last line).

  43. Chris
    February 6th, 2007 at 20:22 | #43

    I just tried to install following all the instructions and ended with commenting out the IF ELSE END.

    Now Tracks starts, but immediately neds with page fulls of erros messages, the first of which is:

    Status: 500 Internal Server Error Content-Type: text/plain Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) /Users/chris/Documents/tracks-

    I guess taht all the following ones are a consequence of thsi one.

    What now?

    Any help is really appreciated.

    Chris

  44. Loopy
    March 21st, 2007 at 20:53 | #44

    For what’s its worth I was having problems getting this to work until I moved the Tracks folder to my Sites folder and changed this:

    development: adapter: sqlite3 database: ~/Documents/tracks-1.041/db/tracks-104.db

    test: adapter: sqlite3 database: ~/Documents/tracks-1.041/db/tracks-104.db

    production: adapter: sqlite3 database: ~/Documents/tracks-1.041/db/tracks-104.db

    to:

    development: adapter: sqlite3 database: ~/Sites/tracks-1.043/db/tracks-104.db

    test: adapter: sqlite3 database: ~/Sites/tracks-1.043/db/tracks-104.db

    production: adapter: sqlite3 database: ~/Sites/tracks-1.043/db/tracks-104.db

    and then http://127.0.0.1:3000

    and presto… Tracks on my mac.

    Thanks for the handy installation and the help.

  45. KiranKumars
    March 10th, 2009 at 10:12 | #45

    Hi, thanks and this helped me lot, but i face problem in starting Ruby server. I downloaded locomotive for MAC (StandardRailsMar2007.dmg) and installed the package in Appliactions/My Rails . I had given given all the parameters in locomotive.yml as below mode: development bundle: /Applications/”My Rails”/Bundles/standardRailsMar2007.locobundle port: 3010 runsatlaunch: 0 identifier: ProjectX

    and i am trying to start the server , but it is not starting.Its giving errors

    The server starts if bundle path is /Applications/MyRails/Bundles/standardRailsMar2007.locobundle and the difference is MyRails folder has space in the above. Why the server doesnt start if folder name has spaces.Is this a bug? and how can i resolve this situtation, can any one guide me in the right direction

  1. February 27th, 2007 at 21:50 | #1
  2. May 16th, 2007 at 19:09 | #2
  3. August 7th, 2007 at 16:17 | #3
  4. May 25th, 2008 at 00:04 | #4