Categories
Mac OSX Programming

Installing DBD::mysql on Mavericks

3 years ago, I posted about getting DBD::mysql to build on OSX 10.6 – it seems the same thing works on Mavericks (10.9) as well!

#   Failed test 'use DBD::mysql;'
#   at t/00base.t line 18.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/Users/simon/.cpan/build/DBD-mysql-4.027-wbgMWL/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/simon/.cpan/build/DBD-mysql-4.027-wbgMWL/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
#   Referenced from: /Users/simon/.cpan/build/DBD-mysql-4.027-wbgMWL/blib/arch/auto/DBD/mysql/mysql.bundle
#   Reason: image not found at /System/Library/Perl/5.16/darwin-thread-multi-2level/DynaLoader.pm line 194.
#  at (eval 7) line 2.

The version of MySQL has changed slightly (and hence the path used) but everything else is the same.

$ sudo install_name_tool -id /usr/local/mysql-5.5.30-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.5.30-osx10.6-x86_64/lib/libmysqlclient.18.dylib

$ otool -D `mdfind libmysqlclient.18.dylib`
Categories
Apple Mac OSX

Extracting ebooks from Apple iBooks for Mavericks

I decided to remove a lot of the read ebooks from my library but wanted to back them up first, especially the ones that weren’t purchased via iTunes. iBooks on Mavericks had “imported” them all from iTunes and as a result I couldn’t just right click on them in iTunes and use Show in Finder.

First step was to locate them – turns out they’re in ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/

Next problem was that all the files had been renamed from something human readable into a large string of hex characters! The Books.plist file contained a lot of metadata, including the original filename and the current full path of the ebook. I wasn’t about to go renaming them manually so wrote a quick Perl script using Data::Plist::BinaryReader to extract the data structures and print the values for ‘BkDisplayName’ and ‘path’ from each book.

Then I found that although some of them were still .epub files, quite a few had been unpacked into directories containing the epub contents but not with the OEBPS subdirectory.

I wasn’t about to go updating the script to repack all the epubs and just on a whim thought I’d try dragging an ebook out of iBooks onto the desktop.. it worked! The one I had tried was one of the unpacked ebooks but on the desktop was a zipped up epub file. I wish I’d tried dragging them in the first place as it would have saved a lot of hassle!

To back them up, I ended up simply selecting all the ebooks and dragging them to a separate folder. Now I can remove all the read ebooks from within iBooks without worrying about losing them.

Categories
Apple Mac OSX Programming

DBD::mysql, MySQL and OS X Lion

I downloaded and installed MySQL Community Server 5.5.15 from http://dev.mysql.com/downloads/mysql/5.5.html

Using CPAN, I then tried to install DBD::mysql on a fresh install of OS X Lion and was presented with an error saying it was unable to load the library.

#     Error:  Can’t load ‘/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle’ for module DBD::mysql: dlopen(/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
#   Referenced from: /private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle

Categories
Mac OSX

OSX, Remote Desktop and typing a hash

I recently had the need to type a hash (#) into a Remote Desktop session from my OSX desktop to a Windows server. Unfortunately to get a hash on a UK keyboard requires pressing ALT + 3 as SHIFT + 3 results in a pound (£). Pressing ALT + 3 through the remote desktop connection didn’t do anything useful so I was somewhat stuck.

Categories
Mac OSX

Leopard + Firewall + Skype = broken

It seems that when the firewall option is enabled (apparently it’s disabled by default) you can only run Skype once without reinstalling it. The second time you try, it bounces a couple of times and stops.
A Skype forum thread about it can be found at http://forum.skype.com/index.php?showtopic=100329

Categories
Apple Mac OSX

synergy2 on Leopard

Having upgraded to Leopard, I found that synergy2 wasn’t working. It’s an application that lets you control multiple machines from a single keyboard and mouse and I use it quite a lot at work.
More information about Synergy2 can be found at http://synergy2.sourceforge.net/
After the upgrade to Leopard (and even after a fresh reinstall) it would start up and then a crash would be logged in /var/log/system.log; searching in Google resulted in a hit that mentions using launchd to start it up and having set it up like that I found that it actually works fine!
The forum post is at http://sourceforge.net/forum/forum.php?thread_id=1848423&forum_id=199580

Categories
Mac OSX

Leopard (Mac OSX 10.5)

Like most Apple users we pre-ordered a copy of Leopard and took delivery of it on the 26th October. I upgraded Tiger to Leopard that evening and despite the initial horror of having some fairly big changes to the UI, I’ve decided it’s not so bad.
Something I didn’t like was the new style dock – it has a shiny effect on it (see image below) which makes it harder to see what’s running. I figured that it wasn’t too much of a problem since I have the dock set to auto-hide and if I need to see what’s running, I can always use Cmd-Tab.

Categories
Current Events Mac OSX Personal

MacLive Expo, London 2007

We just got back from the MacLive Expo in London – it seemed smaller than last year although I could be mistaken. Here are some pictures of various parts of the expo.
Various stands at the expo
More stands at the expo

Categories
Apple Mac OSX

It’s Mac Expo time again

I’ve just found out that it’s time to register for the London Mac Expo for this year. Seems it’s now called Mac Live Expo – more details can be found at http://www.macliveexpo.co.uk/

Categories
Linux Mac OSX

Using vmware server console on Mac OSX

Just recently I’ve been experimenting with VMWare Server on a Linux host and although it’s easy enough to use the console to manage it from a Windows PC, I normally only have my aging PowerBook to hand.
Since there’s no proper OSX console application for VMWare (why not!?), I needed to figure out a different way to manage the virtual servers.
Two options immediately spring to mind – (1) Fire up Virtual PC, Start Windows, Use the Windows console, or (2) Find a way to use the Linux VMWare console.