[{"data":1,"prerenderedAt":598},["ShallowReactive",2],{"blog:2007:getting-started-with-ruby-on-rails-on-mac-os-x":3,"blogMore-Development":584,"comments-getting-started-with-ruby-on-rails-on-mac-os-x":597},{"id":4,"title":5,"body":6,"category":564,"commentCount":565,"date":566,"description":567,"excerpt":568,"extension":569,"filenames":570,"hidden":571,"image":570,"meta":572,"minutes":565,"navigation":573,"path":574,"seo":575,"showCategory":570,"stem":576,"tags":577,"updated":570,"url":581,"wordCount":582,"__hash__":583},"content\u002Fblog\u002F2007\u002Fgetting-started-with-ruby-on-rails-on-mac-os-x.md","Getting started with Ruby on Rails on Mac OS X",{"type":7,"value":8,"toc":548},"minimark",[9,14,26,63,78,86,90,104,115,118,124,127,131,134,140,144,147,153,157,178,182,190,196,206,210,216,222,225,231,237,246,250,253,257,260,268,283,287,295,318,322,328,334,340,344,361,375,381,439,455,461,487,493,499,509,513,540,543],[10,11,13],"h2",{"id":12},"choosing-your-ruby-packages","Choosing your Ruby packages",[15,16,17,18,25],"p",{},"I have decided to get to grips with ",[19,20,24],"a",{"href":21,"rel":22},"https:\u002F\u002Fwww.rubyonrails.org",[23],"nofollow","Ruby on Rails"," and get it set-up on my MacBook Pro. There seem to be a variety of options available:",[27,28,29,39,48,56],"ol",{},[30,31,32,33,38],"li",{},"Use ",[19,34,37],{"href":35,"rel":36},"https:\u002F\u002Flocomotive.raaum.org",[23],"Locomotive",": an all-in-one standalone developer package",[30,40,41,42,47],{},"Official ",[19,43,46],{"href":44,"rel":45},"https:\u002F\u002Fdeveloper.apple.com\u002Ftools\u002Frubyonrails.html",[23],"sources",": configure, compile and install each",[30,49,50,55],{},[19,51,54],{"href":52,"rel":53},"https:\u002F\u002Fwww.robbyonrails.com\u002Farticles\u002F2007\u002F06\u002F19\u002Finstalling-ruby-on-rails-and-postgresql-on-os-x-second-edition",[23],"MacPorts",": package management for free software",[30,57,58,55],{},[19,59,62],{"href":60,"rel":61},"https:\u002F\u002Ffinkproject.org",[23],"Fink",[15,64,65,66,71,72,77],{},"As ",[19,67,70],{"href":68,"rel":69},"https:\u002F\u002Ftheocacao.com\u002Fdocument.page\u002F321",[23],"Scott Stevenson points out"," this is too many options for a system that is described as ",[19,73,76],{"href":74,"rel":75},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRuby_on_Rails",[23],"Convention over configuration",".",[15,79,80,81,77],{},"As I already use Fink for installing the majority of free software on my Mac I decided I’d go with that. At least until ",[19,82,85],{"href":83,"rel":84},"https:\u002F\u002Fweblog.rubyonrails.org\u002F2006\u002F8\u002F7\u002Fruby-on-rails-will-ship-with-os-x-10-5-leopard",[23],"Leopard ships with Ruby on Rails in-the-box",[10,87,89],{"id":88},"preparing-fink","Preparing Fink",[15,91,92,97,98,103],{},[19,93,96],{"href":94,"rel":95},"https:\u002F\u002Fwww.gringod.com",[23],"GrinGod"," gave me a heads-up that we’ll need to turn on the unstable packages to get the gems package and latest version of Ruby. The details are in the ",[19,99,102],{"href":100,"rel":101},"https:\u002F\u002Ffinkproject.org\u002Ffaq\u002Fusage-fink.php",[23],"Fink FAQ"," but in summary:",[105,106,111],"pre",{"className":107,"code":109,"language":110},[108],"language-text","fink configure\n","text",[112,113,109],"code",{"__ignoreMap":114},"",[15,116,117],{},"And choose the option for unstable trees. Then type:",[105,119,122],{"className":120,"code":121,"language":110},[108],"fink selfupdate\nfink index\nfink scanpackages\n",[112,123,121],{"__ignoreMap":114},[15,125,126],{},"And make sure you have rsync or cvs updating turned on to get the descriptions.",[10,128,130],{"id":129},"ruby-via-fink","Ruby (via Fink)",[15,132,133],{},"Ruby is the language we wish to use and Fink currently supports 1.6 and 1.8 The following commands will install 1.8 for us and the Ruby Gems package management system:",[105,135,138],{"className":136,"code":137,"language":110},[108],"fink install ruby\nfink install rubygems-rb18\n",[112,139,137],{"__ignoreMap":114},[10,141,143],{"id":142},"rails-via-gem","Rails (via Gem)",[15,145,146],{},"Now we need the Rails web framework which will be installed using gem.",[105,148,151],{"className":149,"code":150,"language":110},[108],"gem install rails --include-dependencies\n",[112,152,150],{"__ignoreMap":114},[10,154,156],{"id":155},"choosing-your-web-server","Choosing your web server",[15,158,159,160,165,166,171,172,177],{},"There are a number of options available again here including ",[19,161,164],{"href":162,"rel":163},"https:\u002F\u002Fhttpd.apache.org",[23],"Apache",", ",[19,167,170],{"href":168,"rel":169},"https:\u002F\u002Fwww.lighttpd.net",[23],"LightTPD"," and ",[19,173,176],{"href":174,"rel":175},"https:\u002F\u002Fgithub.com\u002Fmongrel\u002Fmongrel",[23],"Mongrel",". I wanted to give LightTPD a shot as it is on Fink and less of a beast than Apache. I tried various combinations but even having installed the lighttpd-fastcgi module I couldn’t get the fastcgi gem to do anything but spew errors so Mongrel it is.",[10,179,181],{"id":180},"mongrel-via-gem","Mongrel (via Gem)",[15,183,184,185,189],{},"Back at that ",[186,187,188],"em",{},"Terminal"," window type:",[105,191,194],{"className":192,"code":193,"language":110},[108],"sudo gem install mongrel --include-dependencies\n",[112,195,193],{"__ignoreMap":114},[15,197,198,199,171,202,205],{},"Select the ",[186,200,201],{},"mongrel 1.0.1 (ruby)",[186,203,204],{},"fastthread 1.0 (ruby)"," options as prompted.",[10,207,209],{"id":208},"testing-ruby-rails-mongrel","Testing Ruby, Rails & Mongrel",[15,211,212,213,215],{},"Again at the ",[186,214,188],{}," window:",[105,217,220],{"className":218,"code":219,"language":110},[108],"rails mytest\n",[112,221,219],{"__ignoreMap":114},[15,223,224],{},"A number of files should be created if Ruby & Rails are working correctly. Now type:",[105,226,229],{"className":227,"code":228,"language":110},[108],"cd mytest\nscript\u002Fserver\n",[112,230,228],{"__ignoreMap":114},[15,232,233,234],{},"You should see a line stating ",[186,235,236],{},"Starting Mongrel listening at 0.0.0.0:3000",[15,238,239,240],{},"Open your browser of choice and navigate to ",[186,241,242],{},[19,243,244],{"href":244,"rel":245},"http:\u002F\u002Flocalhost:3000",[23],[10,247,249],{"id":248},"choosing-a-database","Choosing a database",[15,251,252],{},"You can go with MySQL, PostgreSQL or SQLite from Fink alone. I went with MySQL for a change.",[10,254,256],{"id":255},"mysql-50","MySQL 5.0",[15,258,259],{},"While Mac OS X Server comes with MySQL the standard edition does not. Rather than use the Fink port I went with the official MySQL 5.0 package primarily to get the preferences pane that allows me to start and stop it as required however it also includes a helpful monitoring widget.",[15,261,262,263,77],{},"To install ",[19,264,267],{"href":265,"rel":266},"https:\u002F\u002Fdev.mysql.com\u002Fdownloads\u002Fmysql\u002F5.0.html#downloads",[23],"download and run the MySQL…x86 package",[15,269,270,271,274,275,278,279,282],{},"Copy ",[186,272,273],{},"MySQL.prefPane"," to ",[186,276,277],{},"\u002FLibrary\u002FPreferencePanes"," and re-open ",[186,280,281],{},"System Preferences",". Head into the new MySQL pane and start MySQL up.",[10,284,286],{"id":285},"mysql-tools","MySQL Tools",[15,288,289,290,77],{},"To manage MySQL and download the Mac OS X version of the ",[19,291,294],{"href":292,"rel":293},"https:\u002F\u002Fdev.mysql.com\u002Fdownloads\u002Fgui-tools\u002F5.0.html",[23],"GUI management tool",[15,296,297,298,301,302,305,306,309,310,313,314,317],{},"Run the ",[186,299,300],{},"MySQL Administrator"," application and connect to ",[186,303,304],{},"localhost"," on the default port of ",[186,307,308],{},"3306"," with the user name ",[186,311,312],{},"root"," and a blank password. Don’t forget to change the password by heading over to the ",[186,315,316],{},"Account"," pane.",[10,319,321],{"id":320},"ruby-with-mysql","Ruby with MySQL",[15,323,324,325,327],{},"Install the native Ruby to MySQL library to improve db performance by heading back to the ",[186,326,188],{}," window and executing:",[105,329,332],{"className":330,"code":331,"language":110},[108],"sudo gem install mysql -- --with-mysql-config=\u002Fusr\u002Flocal\u002Fmysql\u002Fbin\u002Fmysql_config\n",[112,333,331],{"__ignoreMap":114},[15,335,336,337],{},"Select the option for ",[186,338,339],{},"mysql 2.7 (ruby)",[10,341,343],{"id":342},"testing-the-database","Testing the database",[15,345,346,347,349,350,353,354,357,358,77],{},"As MySQL doesn’t include a sample database head into ",[186,348,300],{}," and into the ",[186,351,352],{},"Catalogs"," pane. Create a new database by pressing the ",[186,355,356],{},"+"," button and giving it the name ",[186,359,360],{},"mytest",[15,362,363,364,366,367,370,371,374],{},"Select ",[186,365,360],{}," from the left then choose ",[186,368,369],{},"Create Table…"," from the ",[186,372,373],{},"Table Actions"," drop-down list.",[15,376,377,378,380],{},"Enter the table name products then use the ",[186,379,356],{}," button to create the following columns:",[382,383,384,385],"table",{},"\n  ",[386,387,388,384,408,384,425],"tbody",{},[389,390,391,392,391,396,391,399,391,402,391,405,384],"tr",{},"\n    ",[393,394,395],"th",{},"\n      Name\n    ",[393,397,398],{},"\n      Type\n    ",[393,400,401],{},"\n      Primary Key?\n    ",[393,403,404],{},"\n      Nullable?\n    ",[393,406,407],{},"\n      Auto Increment?\n    ",[389,409,391,410,391,414,391,417,391,420,391,423,384],{},[411,412,413],"td",{},"\n      id\n    ",[411,415,416],{},"\n      INT\n    ",[411,418,419],{},"\n      Y\n    ",[411,421,422],{},"\n      N\n    ",[411,424,419],{},[389,426,391,427,391,430,391,433,391,435,391,437,384],{},[411,428,429],{},"\n      name\n    ",[411,431,432],{},"\n      VARCHAR(255)\n    ",[411,434,422],{},[411,436,422],{},[411,438,422],{},[15,440,441,442,165,445,165,448,451,452,77],{},"Click ",[186,443,444],{},"Apply",[186,446,447],{},"Execute",[186,449,450],{},"OK"," then ",[186,453,454],{},"Close",[15,456,457,458,460],{},"Go to the ",[186,459,188],{}," window and cd into the mytest folder you generated earlier.",[15,462,463,464,467,468,471,472,475,476,274,479,481,482,484,485,77],{},"Edit the ",[186,465,466],{},"config\u002Fdatabase.yml"," file using ",[186,469,470],{},"nano"," or ",[186,473,474],{},"TextEdit"," and change the database name from ",[186,477,478],{},"mytest_development",[186,480,360],{},". You will also need to enter the password here, either for your ",[186,483,312],{}," account or ideally a special application-specific account you set-up in ",[186,486,300],{},[15,488,489,490,492],{},"Back at the trusty ",[186,491,188],{}," execute:",[105,494,497],{"className":495,"code":496,"language":110},[108],"script\u002Fgenerate scaffold product\nscript\u002Fserver\n",[112,498,496],{"__ignoreMap":114},[15,500,501,502,508],{},"Now open your browser to ",[186,503,504],{},[19,505,506],{"href":506,"rel":507},"http:\u002F\u002Flocalhost:3000\u002Fproducts\u002F",[23]," and try creating, editing and deleting some products.",[10,510,512],{"id":511},"next-steps","Next steps",[514,515,516,524,532],"ul",{},[30,517,518,519],{},"Watch these great ",[19,520,523],{"href":521,"rel":522},"https:\u002F\u002Fwww.rubyonrails.org\u002Fscreencasts",[23],"Rails screencasts",[30,525,526,527],{},"Run through some of these ",[19,528,531],{"href":529,"rel":530},"https:\u002F\u002Fwww.digitalmediaminute.com\u002Farticle\u002F1816\u002Ftop-ruby-on-rails-tutorials",[23],"12 tutorials",[30,533,534,535],{},"Read the ",[19,536,539],{"href":537,"rel":538},"https:\u002F\u002Fwww.amazon.com\u002FAgile-Development-Rails-Pragmatic-Programmers\u002Fdp\u002F0977616630\u002F",[23],"Agile Web Development with Rails book",[15,541,542],{},"And of course trying to find an editor\u002FIDE that supports Ruby as Xcode certainly doesn’t and TextMate costs money (I’m happy to pay for things when I’m committed to the tech, not before)",[15,544,545],{},[186,546,547],{},"[)amien",{"title":114,"searchDepth":549,"depth":549,"links":550},2,[551,552,553,554,555,556,557,558,559,560,561,562,563],{"id":12,"depth":549,"text":13},{"id":88,"depth":549,"text":89},{"id":129,"depth":549,"text":130},{"id":142,"depth":549,"text":143},{"id":155,"depth":549,"text":156},{"id":180,"depth":549,"text":181},{"id":208,"depth":549,"text":209},{"id":248,"depth":549,"text":249},{"id":255,"depth":549,"text":256},{"id":285,"depth":549,"text":286},{"id":320,"depth":549,"text":321},{"id":342,"depth":549,"text":343},{"id":511,"depth":549,"text":512},"Development",4,"2007-07-09T00:48:45+00:00","Step-by-step walkthrough of setting up Ruby on Rails on Mac OS X via Fink and gem, including Mongrel as the web server and MySQL 5.0 as the database, with a sample scaffold to verify the stack.","[object Object]","md",null,false,{},true,"\u002Fblog\u002F2007\u002Fgetting-started-with-ruby-on-rails-on-mac-os-x",{"title":5,"description":567},"blog\u002F2007\u002Fgetting-started-with-ruby-on-rails-on-mac-os-x",[578,579,580],"Apple","macOS","SQL","\u002Fblog\u002F2007\u002Fgetting-started-with-ruby-on-rails-on-mac-os-x\u002F",807,"PvNLGq2eUUNi0Ed364V_apV0IvgiKlmz6wqkkv3yTKI",[585,589,593],{"title":586,"date":587,"url":588},"Transactions in the MongoDB EF Core Provider","2025-10-25","\u002Fblog\u002F2025\u002Fmongodb-explicit-transactions\u002F",{"title":590,"date":591,"url":592},"Queryable Encryption with the MongoDB EF Core Provider","2025-09-22","\u002Fblog\u002F2025\u002Fmongodb-queryable-encryption\u002F",{"title":594,"date":595,"url":596},"Lazy Loading with EF Core Proxies","2025-04-02","\u002Fblog\u002F2025\u002Fef-proxies\u002F",[],1780900531721]