Blog posts tagged "osx"


June 18th, 2005

I realized recently that I had given up on Fink months ago, and have been building everything from source for a while now. I’m comfortable with apt-pinning and regularly scare my sysadmin friends by running frankenstein Debian systems, but I’ve never figured out Fink, and it never seems to have the package I want in the release I’m using.

Woke up this morning and realized that I had a long todo list for the weekend, and so of course I decided to switch over to using DarwinPorts.

So far, so good.

Tagged: Uncategorized , ,

Some Rails Tips (Especially for OS X Hackers)

April 1st, 2005

The last thing on earth the web needs right now, is another blog/blog post about another developer stumbling his way up the admittedly short Rails learning curve. Still, here a few tips, especially for the newbie Rails and OS X hackers.

Use Breakpoint

Breakpointer is great. Took me a little while to figure out how it worked as I was expect something like gdb, while breakpointer is really more of a evolutionary punctuated equilibrium from the scattering ‘print’ statements through out the code style of debugging. Instead of

print "going into crashing_function"
crashing\_function(var1, var2, var3)
print "after crashing_function"

You say

breakpoint "going into crashing_function"
crashing_function(var1, var2, var3)

And when breakpoint is reached you’re dropped into an irb shell, and can inspect those variables, call methods, and generally re-write your code on the fly.

What you can’t do is step. So if you’re interested in what is going on in crashing_function you’ll need something like

def crashing_function(var1, var2, var3)
   breakpoint "start of crashing function"
   breakpoint "end of crashing function"

But how you ask does a web app bring up an interactive shell? In your Rails script directory (where generate and server are) you’ll find breakpointer. Simply run it, and it will attempt to connect to a dRB server that Rails in development mode brings up behind the scenes. You’ll see

No connection to breakpoint service at druby://localhost:42531
Tries to connect will be made every 2 seconds...

Now go hit your web app over on localhost:3000, and when you reach a breakpoint you’ll see your app hang, and the little spinning loading icon go on and on and on. This is your clue to switch back to the terminal where you ran breakpointer

There instead of ‘No connection’ you’ll see

Executing break point "start of crashing function" at 
      ./script/../config/..//app/models/crashme.rb:15 in `crashing_function'

That is: you’re breakpoint, the file, and the name of the function. From here you can do things like

puts var1

And lots more stuff which I haven’t really started playing with. What you can’t do is next, step, run, etc. When you’re tired of the view from this breakpoint, and are ready to be whisked away to the next one, type


SecurityError (Insecure operation ‘write’ at level 4)

What if all that doesn’t happen. What if your browser doesn’t seem to go into a spinning death spiral but instead promptly pops up the error message like SecurityError (Insecure operation 'write' at level 4). The default answer is you need Ruby 1.8.2 instead of Ruby 1.8.1. “But”, I hear you say, “I’ve already got Ruby 1.8.2”. At which all the wise heads on on #rubyonrails will nod sagely, and says, “Yes, grasshopper, but you are a Mac user, and have the wrong 1.8.2.”. Basically the .dmg was silently upgraded, and you’ll need to re-download and re-install it.

Living With Your Model / Using CocoaMySQL

I’ve been using MySQL for 8+ years now, and to say I’m pretty comfortable with the mysql command line client is an understatement. (though I’ve never tricked it out like Jeremy) That said, working with Rails where a significant portion of your applications logic is inferred directly from the database means you spend a lot of time living in the database. And so for the first time ever, I went looking for a graphical MySQL client, and found CocoaMySQL. It works well with a lot of room for improvement, but my one critical tip for you is, if you’re working with a dataset of any size, go to Preferences and make sure to check “Limit results to 100 rows” or you’re going to be dealing with a bad case of the spinnies. (and unlike the breakpointer tip, this is not desirable)


How do you get a neat, JavaDoc-y looking document site like As far as I can tell you don’t. But the next best thing is gem_server. Just run it from the command line, and it will bring up another instance of WEBrick, this one on port 8808, browse to it, and boom, you’ve got docs for all installed gems. (admittedly all versions of all installed gems, which gets a little ugly)

Thats what I’ve picked up so far, most of it unfolded fairly rapidly, but if I can pass along the accumulated wisdom of a couple of hours, there you go.

update: a recipe for generating Rails docs with Rdoc

Tagged: Uncategorized , ,

The Kettle Dilemma and Growl

December 4th, 2004

I can be a little distracted at times, but the sight of a heavy, solid black kettle glowing an eery incandescent orange tends to rivet my attention.

I don’t know about you but I have a habit on these cold wet nights to put a kettle on, and then start a project while waiting for the water to boil. And I get distracted, and come back a view hours later. So inspired by a comment on Remind as command-line iCal replacement, I wrote a simple bash script to growl at me 5 minutes after I run it.


Download Growl, and GrowlNotify. Install the Growl.dmg, and extract the growlnotify binary and copy it /usr/local/bin (or somewhere else in your path). Now go to System preferences and turn on the Growl framework.

No at

My first attempt was going to use at, but after fiddling for a bit (and reaching out for expert assistance from Josh) I found the following line at the top of at man pages:

at, batch, atq, atrm are all disabled by default on Mac OS X.

pure bash

Rather then fiddle with overriding Apple’s descision in this matter, I did a little googling and figured out how to simulate what I wanted in bash.

Without further ado, my kettleison script.


TITLE='Time to take the kettle off'
MSG='Seriously, new kettles are expensive'

sleep $DELAY
echo $MSG | growlnotify $TITLE 2>/dev/null
} &

Copy this into your path, and you should be all set.

Obvious Improvements

Obviously it would be nice if the script took arguments on the command line. Even better would be if the notifications stuck around a little longer then the default 5 seconds. But those are both for another night (wasted too much time on at)

Additionally this script is entirely incompatible with a good book, as with most other non-OS X running devices.

Dream of Electric Sheep

November 15th, 2004

One of the most popular accidental cAts skillshare was on Electric Sheep. Electric Sheep is a cross platform (Linux, OS X, Windows) screensaver built on the realization that people were running SETI@Home for the screensaver not the alien contact potentials, and so harnesses all those free CPU cycles to produce gorgeous, swoopy, colorful movies across a wide range of genetically determined axises.

After being installed it can take a while to get your first “sheep” from the sheep server, and can fail behind some firewalls. At geek gatherings we recommend bootstrapping your install by copying someone else’s existing sheep folder (on OS X this is ~/Library/Application Support/ElectricSheep). If you want to run Electric Sheep as your desktop background, either because you’re a sheep junkie, or because you want maximize your sheep cycles, I found Backlight, was a nice freeware app for doing this.

update [2004/11/16]: Just figured how to vote, and thereby influence the evolution of new sheep. The arrow keys, up arrow for yes, down arrow for no.

Tagged: Uncategorized ,