{"id":10,"date":"2007-11-06T00:21:46","date_gmt":"2007-11-06T00:21:46","guid":{"rendered":"http:\/\/installingcats.com\/2007\/11\/06\/get-os-x-leopard-setup-for-ruby-on-rails-development\/"},"modified":"2007-11-06T00:21:46","modified_gmt":"2007-11-06T00:21:46","slug":"get-os-x-leopard-setup-for-ruby-on-rails-development","status":"publish","type":"post","link":"https:\/\/installingcats.com\/2007\/11\/06\/get-os-x-leopard-setup-for-ruby-on-rails-development\/","title":{"rendered":"Get OS X Leopard Setup for Ruby on Rails Development"},"content":{"rendered":"
After doing a clean install of Leopard (on a blank partition) and importing user settings \/ home directory, this is what I needed to do to install the Ruby on Rails development environment on Leopard OS X 10.5.<\/p>\n
TextMate transferred OK as an application during the import phase after the install of Leopard. The only thing needed was a re-setting-up of the command line launcher for Textmate. A symbolic link to TextMate’s mate program in Applications placed within the \/usr\/bin directory does the trick:<\/p>\n
sudo ln -s \/Applications\/TextMate.app\/Contents\/Resources\/mate \/usr\/bin\/mate<\/pre>\nMySQL 5<\/h2>\n
\n
- Download OS X 10.4 pre-compiled mysql binary<\/a> from MySQL.com (use FTP link if you can, for some reason Firefox recognized .dmg as text mime type for the HTTP link).<\/li>\n
- Double click the .dmg file to mount the disk image.<\/li>\n
- Run the mysql-5.0.45-osx10.4-i686.pkg installer.<\/li>\n
- Run the MySQLStartupItem.pkg to have MySQL start upon system boot.<\/li>\n
- Add the location of the mysql executable to your path. For me this involved adding a line to my .profile file in my home directory\n
export PATH=${PATH}:\/usr\/local\/mysql\/bin<\/pre>\n<\/li>\n- Then start the mysql daemon\n
sudo \/Library\/StartupItems\/MySQLCOM\/MySQLCOM start<\/pre>\n<\/li>\n- At this point there should be a socket file created in your \/tmp directory for connecting to mysql. Check that the following file exists: \/tmp\/mysql.sock<\/li>\n
- Login to mysql and change the root password:\n
mysql -h localhost -u root<\/pre>\n<\/li>\n- \n
mysql> USE mysql;<\/pre>\n<\/li>\n- \n
mysql> UPDATE user SET Password=PASSWORD('root-pwd') WHERE user='root';<\/pre>\n<\/li>\n- \n
mysql> FLUSH PRIVILEGES;<\/pre>\n<\/li>\n- \n
mysql> EXIT<\/pre>\n<\/li>\n- Create any other mysql accounts you need:\n
\nmysql> GRANT ALL PRIVILEGES ON *.* TO 'prod'@'localhost' \nIDENTIFIED BY 'some_pass' WITH GRANT OPTION;<\/pre>\n(do not include the backslash ” in this command, which was used to denote a wrapped line)<\/li>\n
- At this point you might want to clear out your mysql command cache (which contains what password you just set for root) located in your home directory.\n
echo -n > ~\/.mysql_history<\/pre>\n<\/li>\n- Now load your data back into MySQL. For me this consisted of exporting the database from the production site\n
mysqldump -u <username> -p -q --single-transaction \n<db_name> > <backup_filename><\/pre>\nthen create the database within mysql before importing to that database<\/p>\n
mysql>create database my_kickin_database<\/pre>\nFrom the terminal:<\/p>\n
mysql -u <username> -p my_kicking_database < <backup_filename><\/pre>\n<\/li>\n<\/ul>\nImageMagick RMagick<\/h2>\n
Despite all the badpress RMagick gets about using scads of RAM and that ImageScience is a better solution, RMagick is still quite useful. The RAM stuff is also not an issue if you can figure out how to do your image manipulation calls via command line. Plus it’s got a lot more features than FreeImage\/ImageScience and in my experience, more stable as well.
\nSolomon White’s got a great shell script for installing ImageMagick and RMagick from source without MacPorts<\/a> and that’s the route that I’ve chosen to go. Check the instructions at his page. Thanks Solomon.<\/p>\nBe sure to install Mac OS X XcodeTools from the Leopard install DVD (Optional Installs\/Xcode Tools\/XcodeTools.mpkg) before attempting this source install of ImageMagick\/RMagick; The compilers necessary to build these packages are not installed on OS X by default. In particular what you need are Developer Tools Essentials and UNIX Development Support. All other stuff in the Xcode Tools package are not essential for this install. Install those two packages. Should take about five minutes or so.<\/p>\n
You may want to run each of the steps listed in Solomon’s script one at a time in case one of the them fails. You wouldn’t want to finish building ImageMagick from source (not exactly quick) when you find out that your download of the jpeg source libraries failed and ImageMagick got built without JPEG support. (This is a current issue with the jpeg source download source that Solomon’s script is using for the download, so caveat emptor).<\/p>\n
UPDATE: The RMagick gem install may fail with an error of “too many examples failed” if the compilation and install of the jpeg package did not install static nor shared libraries (default behaviour). What this means is that the JPEG package is installed binary executable files, but not libraries that other programs such as ImageMagick can use to manipulate photos and image files. This is easy to correct. To make sure that the JPEG package installs the actual JPEG libraries do the following within the jpeg-6b directory (which was created when you untar’d the jpeg6b.tar.gz source file):<\/p>\n
\n cp \/usr\/share\/libtool\/config.sub .\n cp \/usr\/share\/libtool\/config.guess .\n .\/configure --enable-shared --enable-static\n make\n sudo make install<\/pre>\nThanks to Matt King for posting instructions on fixing the JPEG library ImageMagick \/ RMagick errors<\/a>.<\/p>\n
That should be all that’s required to install the actual JPEG libraries. Now return to the ImageMagick directory (also created when you untar’d the ImageMagick source files) and try configuring and building again (NOTE: the “configure” line is just one line, no carriage returns in between all those –with –without command line arguments):<\/p>\n
\n.\/configure --prefix=\/usr\/local --disable-static --with-modules\n--without-perl\n--without-magick-plus-plus --with-quantum-depth=8\n --with-gs-font-dir=\/usr\/local\/share\/ghostscript\/fonts\nmake\nsudo make install<\/pre>\nRuby-debug<\/h2>\n
This is the god of command line debugging for Rails<\/a>. Grab it and gem install that baby. Once you get used to it, you’ll love it.<\/p>\n
Resolution Phase<\/h2>\n
Once you’ve got these guys installed you should check whether you need any other gems specific to your Rails project. The gems you can skip since Mac OS X Leopard’s Ruby install includes them already: Capistrano 2.0 (and requirements), RedCloth 3.04, mongrel 1.01, hpricot .6, fastthread 1.0 and perhaps others that I’m forgetting about.<\/p>\n
At this point, wander over to your Rails project directory and fire it up (using ruby-debug of course): rdebug -n script\/server and check that everything is peachy. If things blow up, don’t panic. Things to check:<\/p>\n
\n
- If you were previously using MacPorts for your MySQL install, you’ll likely have a different sockets file location now. By default MacPorts slapped the socket file somewhere like: \/opt\/local\/var\/run\/mysql5\/mysqld.sock Although now you’re playing with a socket file in \/tmp\/mysql.sock. Head over to your config\/database.yml file in your Rails project and make sure your development environment is pointing at the right socket file and that the socket file is actually there.<\/li>\n
- Read over the webrick log that’s upchucked an error. Good chance that at the top of that error you’ll see a call to some missing gem that you’ve forgotten to load up. Head on over to RubyForge<\/a> and rectify your situation.<\/li>\n<\/ul>\n
Share this:<\/strong> <\/a> <\/a> <\/a> <\/a> <\/a> <\/a> <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"
After doing a clean install of Leopard (on a blank partition) and importing user settings \/ home directory, this is what I needed to do to install the Ruby on Rails development environment on Leopard OS X 10.5. TextMate TextMate transferred OK as an application during the import phase after the install of Leopard. The […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,4,5],"_links":{"self":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/posts\/10"}],"collection":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}