9 Comments

Summary:

I’ve been working more in web development lately, both in PHP (picking up more freelance work) and learning Ruby on Rails. It’s always been something of a hobby of mine to try new things with web programming, but one thing always makes me clench my fists […]

I’ve been working more in web development lately, both in PHP (picking up more freelance work) and learning Ruby on Rails. It’s always been something of a hobby of mine to try new things with web programming, but one thing always makes me clench my fists and gnash my teeth: the Mac OS X user “Sites” folder…

It sounded like a good idea at the time, much easier than trying to wrestle Apache onto my Windows dev machine (always a futile endeavor). But when I more recently looked at my “Sites” folder, I found that I’m drowning in projects. Fortunately, our recent review of “Headdress” sparked my interest, as it fixes that problem, in a manner of speaking. At least, for the lighter work.
I’ve been using PHP a bit more recently since I found CakePHP, which provides for some amazing development in the lines of Ruby on Rails (without the Ruby). The “pretty URLs”, scaffolding, MVC, and more – CakePHP does much of what RoR can do.
But, if you still feel more inclined towards Rails, you don’t really need to worry about installing a Rails server on your development Mac (unless you plan on hosting it there as well). Locomotive, a nice open source project, will run and manage your Ruby web apps for you, using the latest package of Rails. The only thing you’ll have to install besides Locomotive itself is the MySQL server to handle the database functions. Loco always comes with the latest stable package of the Rails frameworks. The benefits of Locomotive include the fact that you don’t have to fight with installing Ruby on Rails manually, and you don’t have to keep your Rails project in the Sites folder unless you really want to.
So, even though we have that folder intended for sharing/running our PHP/Rails-based web apps, we’re no longer confined to the limitations of the Sites folder. And, in the past year, packages and binaries have become available which allow us to easily get up and running with web development on Mac OS X.

Binaries and Easy installation/setup for:
PHP
MySQL
Apache
Locomotive

Other links:
TextMate – a nice Ruby-aware text editor that works amazingly well with Locomotive
SubEthaEdit – an old favorite text-editor of mine (*was* a favorite until they killed the “free for non-commercial use” license)

You’re subscribed! If you like, you can update your settings

  1. You might not know, but you were never confined to the “sites” folder. All you had to do was
    #: vi /etc/httpd/httpd.conf (or other use an other editor) and put in a virtual host or change the document root, etc. You should have picked up the Apache in Nutshell book before ranting on about something that isn’t even true. Confined, preposterous!

  2. Continuing on the same thread as the above comment, you not confined to the sites folder with a Rails app, either.

    Once you generate the app using the ‘rails’ command, simply cd into the project folder and type ‘script/server’. This starts up Rails’ built-in webserver (Webrick by default, though this can be changed to several others if you so wish) on port 3000 (this too can be changed).

    Besides being totally portable (you can place the app anywhere you want), this option is often easier since the server launched by Rails is already set up for Rails, including FastCGI. If you’ve installed the whole shebang manually, you also get the added advantage of having the latest version of Ruby (including Gems), Rails, and MySQL.

    So, really, it’s no big deal

  3. Echoing the previous comments you’re not locked into using the “sites” folder for any web site or a Rails app on a Mac.

    If a person is not familiar with working from the terminal I can maybe see where Dan Benjamin’s guide might cause some frustration , but that guide is basically a cut and paste for someone to manually install Ruby and Rails from source and this makes it easier for someone to apply any patches or fixes themselves. For example it looks like the performance fix for memcached on OS X is not being used from looking at the environment.plist.

    And while Locomotive has lighttpd, mongrel and all the items you would need to run it with Apache 1.3 or 2, another option for people needing less config files and more of a gui for the web server is LiteSpeed. It has a great Ruby module and an excellent web interface to admin the server.

  4. Bill is correct. All of my Rails apps live outside of the Sites folder in an aptly named “Ruby” folder. WEBrick makes this ridiculously easy.

  5. I have found that using Headdress (http://headdress.twinsparc.com) is perfect for managing multiple development versions. Basically it manages the virtual hosting portion of the Apache httpd.conf file assigning different port numbers to different sites, solving the subdirectory tangle I have encountered before.

    I cannot speak for it working with RoR since I stay in PHP, but its works well for me.

    Also, if CakePHP works best for you stick with it, but I started using a little PHP framework called Code Igniter (www.codeigniter.com) and fell in love. It’s just the right amount of framework to not get in the way.

  6. When I was talking about being confined to the sites folder, it is because that is the only easy way to use and manage it… To restart that server, you need only to hit “stop” then “start” in the “Personal Web Sharing” preference.
    I’m sure there are a million ways to do it by digging through the innards of Apache, but those tend to be a bit more difficult for most folks.

  7. watchingnow » Blog Archive » links for 2006-12-29 Friday, December 29, 2006

    [...] On Web App Development, the “Sites” folder, and Ruby on Rails… at The Apple Blog (tags: development osx ruby_on_rails php) [...]

  8. The only thing I want is to be able to browse sites on my local machine’s webserver in Parallels Windows IE6 without using the IP. Still fairly difficult, unless someone else knows? Halp!

    Thanks.

  9. Don’t Look Here » Blog Archive » More links to some cool apps and stuff Wednesday, February 21, 2007

    [...] Ruby on Rails article at The Apple [...]

Comments have been disabled for this post