Showing posts with label OS X. Show all posts
Showing posts with label OS X. Show all posts

Friday, 14 March 2008

Lighting your campfire with fluid

Note: The RichText blog has moved to www.ricroberts.com



Inspired by blog posts from Robby Russell, and thoughtbot, we've recently started using Campfire for
text-chat between our distributed Swirrl team members.

As we all use macs, we were previously using Apple's iChat, with aim/.mac accounts. However, we often had connectivity problems with this, and so I went on the lookout for something new.

Although Campfire doesn't let you display a 'status', we use the idea that if you're in the chat room then you're available for chatting, and if you're not, then you're either away or don't want to be disturbed. This works fine for us. One major benefit of Campfire is that the transcripts of all chats are stored on the server for easy searching.
fluid logo
As is usual for a 37 signals application, The user interface is clean and intuitive. If you're on a mac, the user experience can be further enhanced by using fluid. Fluid lets you create what it calls "Site Specific Browsers". These are bascially uber-bookmarks that you can put in your dock, and let you launch a site in its own little browser as if it was a standalone app.

When using fluid, if you have any unread messages in a chat it handily shows up the dock icon (the image for which can be downloaded here).

If a conversation gets too complicated for text-chat, we still resort to an iChat voice chat, for the reasons described in this old post. iChat also offers the benefit of screen-sharing if you're on Leopard.



Digg Technorati del.icio.us Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

Please also visit the Swirrl blog

Thursday, 6 March 2008

Rails on Mac OS X Leopard

Note: The RichText blog has moved to www.ricroberts.com

We'll get to the instructions for setting up rails on Leopard in a moment, but first a bit of background...

A few days after it was released, I changed over to using Mac OS X 10.5 (Leopard) as my platform for developing rails apps. When I first installed Leopard it took me a little while to figure out the best way to do things, as Leopard comes with lots of rails development features pre-installed.

Recently, after reinstalling my OS, I had to figure some of it out again as I hadn't made enough notes. So this time, I thought I'd document it properly and share it on my blog for the benefit of others (and so I don't forget too!).

As you might remember from this post last year, I'm a fan of using Netbeans for my rails IDE. Since that post, it has come out of beta and is now a fully fledged release (currrently at v6.0.1).

However, I couldn't get its step-through debugger to work with Leopard's installation of rails. I think is is because Netbeans assumes certain relative paths between the ruby interpreter and your gems, which differ in the Leopard standard install.

After being inspired by this post by Robby Russell, I decided to use Macports as my solution. Macports gives you a self contained environment for installing stuff. Everything installed under Macports lives in /opt/local, so if you mess up your Macports environment, you can easily just trash this folder and start again.

Installation Procedure


Here goes... The following instructions walk you through how to set up a development environment with Ruby, Rails, MySQL, Netbeans and Subversion on OS X 10.5 "Leopard".

Xcode
Before doing anything else, we need to install the Xcode tools from the Leopard DVD. Just double click on the installer and away it goes.

Macports
Download the installer from the Macports site, and run it.
(I used the dmg for v1.5.0 for OS X 10.5, but I think v1.6.0 is out now so you might want to try that one).

MySQL
Now, for MySQL, I just downloaded the package from the MySQL site, and installed it.

The problem I've found with this using this package is that the preference pane and automatic startup item don't work quite right, but there are workarounds for this. In particular, this worked for me:


"[...] the working MySQL.prefPane is here

and to get the StartupItem to work (see bug#25008), copy the (if existent)
/usr/local/MySQLCOM directory to /Library/StartupItems/MySQLCOM "


There are also some great free GUI tools available on the MySQL site too. At the time of writing, there isn't a dedicated package for these available for OS X 10.5 -only 10.4, but it works fine.

Set paths
This step is important! Dont skip it.

edit ~/.bash_profile, for example using TextMate:
mate ~/.bash_profile

and add the following line:
export PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

(As I mentioned before, anything installed in Macports is installed under opt/local)

Save the file, and restart your terminal session to pick up the changes.

Install ruby and rubygems in Macports

sudo port install ruby
sudo port install rb-rubygems


Install all your required gems

For example:

sudo gem install rake
sudo gem install rails
sudo gem install capistrano
sudo gem install termios
sudo gem install mongrel
sudo gem install mongrel_cluster
sudo gem install ruby-debug
sudo gem install ruby-debug-ide


(The ruby-debug and ruby-debug-ide gems above are required if you want step-through debugging to work in Netbeans).

Subversion
I just use the subversion installation that comes with Leopard, as this works fine.

Netbeans
Download Netbeans from here, and run the installer. (For developing rails apps, you just need the 'ruby' bundle).

Debgging in Netbeans
In Netbeans, under Preferences->Ruby, set the ruby interpreter to /opt/local/bin/ruby
The fast debugger radio button should become available - select it.

That's pretty much it. You should now have a fully functioning setup for developing on rails.

Note: I use svn over ssh to access my subversion code repository. Below are some instructions for getting this to work with Netbeans. You can safely ignore all that follows if this doesn't apply to you - Netbeans works fine 'out of the box' with svn over http...

svn+ssh in Netbeans
In order to get the svn+ssh protocol to work with Netbeans, you need to set up a ssh key, and set your mac up to remember it. Here's how to do this

1. Create a pair of keys on your local machine.
From your home directory on your mac, run the following command:
ssh-keygen -t dsa

This will prompt you for a secret passphrase - make sure to use a good passphrase. When this is done you will get two files called id_dsa and id_dsa.pub in your ~/.ssh dir.

2. On your server, ensure that the .ssh directory exists for the user
Log in to your server via ssh
ssh myuser@myserver.net

make a .ssh hidden directory
mkdir ~/.ssh


3. Place your public key on your server
On your mac, run
ssh myuser@myserver.net 'cat >>.ssh/authorized_keys' <~/.ssh/id_dsa.pub


4. Try to log in to the server
ssh myuser@myserver.net


You will be asked for the passphrase

In OS X Leopard, there is a user interface for ssh-agent which will ask you if you want to remember the passphrase, and will store it in your keychain. From then on, you wont need to enter a password or a passphrase for this user.

5. Edit the subversion config
This step is required because, although when you check out from an svn repository in Netbeans, the dialog asks you for a tunnel command, it forgets that when you restart the IDE.

On your mac, edit the ~/.subversion/config file (note: this file wont exist unless you've previously run Netbeans)
mate ~/.subversion/config


Add an entry under the [tunnels] section like this:
ssh = $SVN_SSH ssh -l my_ssh_username

Save the file.

Now, Netbeans will be able to access your svn repository over ssh without needing a password from you.

6. Checkout from your repository
In Netbeans, If you go to the Versioning->Checkout dialog, you will see that the tunnel command is pre-populated for you. Just enter your repository location eg:

svn+ssh://myserver.net/repository

and everything should work fine.



Digg Technorati del.icio.us Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

Please also visit the Swirrl blog

Thursday, 8 March 2007

NAS drive for Mac and PC

Note: The RichText blog has moved to www.ricroberts.com

Not so long ago, I went on the lookout for a Network Attached Storage (NAS) drive that I could use with my Mac and my PC.

This proved a little bit more awkward than I expected because many NAS drives only supported Macs by allowing you to format the disk in FAT32. This is all very well until you want to put files larger than 4GB on there, such as disk images.

I eventually settled on the LaCie Ethernet Disk Mini. This product uses the XFS file system, which has a maximum file size of 8 exabytes (should be enough!). It supports connections from Windows, Apple, HTTP and FTP. It lets you define shares and users, and even allows you to connect another USB disk for backups or extra storage.

Works a treat with both my PC and my Mac. Definitely recommended.



Digg Technorati del.icio.us Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

Please also visit the Swirrl blog

Friday, 26 January 2007

Setting up rails on OS X (including radrails)

Note: The RichText blog has moved to www.ricroberts.com

Hello. This post documents how to get rails going on Mac OS X (I'm using 10.4.8, by the way).

Well, basically I followed these brilliant instructions on Hivelogic.com (except I used ruby 1.8.5 instead of 1.8.4) and it just worked! The only little quirk was getting the lightTPD web server to work properly. I had to tweak the paths on the first line of the dispatch.cgi, dispatch.fcgi and dispatch.rb files (in the public folder of my rails project) as they were pointing to a windows-style path.

Radrails pretty much just worked "out of the box" too, but to get radrails to start the lightTPD server properly, I set up a symbolic link like this...

ln -s /usr/local/sbin/lighttpd /usr/bin/lighttpd
...as radrails was having trouble finding it initially. (Credit for this last bit goes to Marc from the radrails community). Note that even after this link is setup, the radrails never reports the lightTPD server as 'started' - it just stays as 'starting...', but it does actually seem to start it properly. I also noticed that the lightTPD server starts on the last port you used for it, and it doesn't pay attention to the one that you specify in radrails.

Remember this post from September where I explained how to setup debugging in radrails on Windows XP? Setting up debugging for radrails in OS X is almost exactly the same, but in the interpreter arguments page of the debug dialog you'll want to put something like:

-I"/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.1/bin"

Also, I had trouble getting debugging to work with lightTPD, so I've put the following in the program arguments to force it to use webrick instead.

webrick -p3001

That's it. enjoy!

UPDATES (March 07):
There are now updated instructions on Hivelogic.com.
You might also want to try Textmate and ruby-debug



Digg Technorati del.icio.us Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

Please also visit the Swirrl blog