suburbia

Premshree's (品速力) Personal Weblog

etc.

Export Firefox Bookmarks to Safari
suburbia
[info]premshree

Firefox on OS X sucks. Big time. I decided to move to Safari, but I couldn’t do that without exporting my bookmarks. Here’s how I did it:

The Firefox bookmarks is in an HTML file. It’s typically located at ~/Library/Application Support/Firefox/Profiles/<profile name>/bookmarks.html. Safari stores its bookmarks at ~/Library/Safari/Bookmarks.plist, which is a binary file.

Use this simple script to export your Firefox bookmarks as a readable XML, and follow these steps:

renegade:~ $ ruby ff2safari.rb  > ~/Library/Safari/Bookmarks.xml
renegade:~ $ cd ~/Library/Safari/
renegade:~/Library/Safari $ mv Bookmarks.plist Bookmarks.plist.backup
renegade:~/Library/Safari $ plutil -convert binary1 -o Bookmarks.plist Bookmarks.xml

Note that this script simply dumps all your Firefox bookmarks in Safari’s Bookmarks Bar. (I have a very few bookmarks on my browser, most of which are in the Bookmarks Toolbar.) You could use an XML parser to export bookmarks as is. To understand the format of the XML you need to generate, you might want to export the existing Safari Bookmarks file to XML:

renegade:~/Library/Safari $ plutil -convert xml1 -o readable.xml Bookmarks.plist

One interesting thing to note: a ktrace/kdump on Safari didn’t do any open on Bookmarks.plist. I wonder why.

This post brought to you from Safari.


Building Pugs on OS X
suburbia
[info]premshree

It’s indeed not very straightforward to install Pugs on OS X. There’s some good instructions available here. Anyway, I’ll just rehash most of the things mentioned there with the current state of the art, and some additional notes. These instructions are for GHC 6.4.1, hs-plugins (the latest), parrot 0.4.2 and Pugs 6.2.11.

Install parrot

Download parrot.

sudo mv parrot-0.4.2/ /usr/local/
cd /usr/local/parrot-0.4.2/
perl Configure.pl
make
make test # optional
sudo make install

Install GHC

(You’ll need DarwinPorts for this.)

sudo port install ghc

This will take a *long* time. Took me a little more than five hours. (Optionally, you could probably download the OS X binary.)

Install darcs

darcs is a revision control system, written in Haskell, required to get hs-plugins.

sudo port install darcs

Again, you could optionally download a binary.

Install hs-plugins

darcs get http://www.cse.unsw.edu.au/~dons/code/hs-plugins
cd hs-plugins/
runhaskell Setup.lhs build
runhaskell Setup.lhs install
sudo ranlib /usr/local/lib/plugins-1.0/libHSplugins-1.0.a

Install Pugs

Download Pugs.

export PUGS_EMBED=perl5,parrot
export PARROT_PATH=/usr/local/parrot-0.4.2
perl Makefile.PL
make
sudo make install

make will take a while. Took me around two hours. The wait is worth it; however, you could optionally use make unoptimized — this will make Pugs compile faster, but will run much slower.

That should be it. Pugs should run fine now (here’s a screenshot):

$ pugs
...
^z
$ pugs -e "print 'hello, world';"
hello, world


Lookie!
suburbia
[info]premshree

Ruby-GTK Uploadr running on OroborOSX on Mac OS X Tiger. Of course, it doesn't feel native, but at least better than vanilla xorg. I should probably try playing around with GTK+OSX.


Flickr Uploadr on OS X
suburbia
[info]premshree

So I finally managed to get my GUI Flickr Uploadr to work on OS X. It was not easy installing ruby-gtk2 in that I had lots of dependency issues. The issues were mostly with atk, gdkpixpuf, and glib. At first, I tried installing GTK2 using Fink. It failed because of GCC issues with glib (I think), which I later figured was because of a problem with pkg-config. I ditched Fink, and used DarwinPorts. Things were good.

After that, I had GTK initialization issues, which was because I hadn’t exported DISPLAY (to 127.0.0.1:0; thanks, Gopal!).

I couldn’t use my old code as is because the Ruby-GTK2 bindings on my FreeBSD box is an older version. (I’ll put the code up sometime later. And maybe also try to document some poorly documented Ruby-GTK2 stuff like Gtk::TextView, Gtk::TextBuffer, etc.) So, it works, but not perfectly:

Ruby-GTK Uploadr running on OS X

Yeah, it looks horrible, but then I&rsquo'm not going to play with it on OS X again—I just wanted it to work.

Oh, by the way, Google Talk is *love*!