Archive for the 'Apple' Category

Installing PHPUnit on Snow Leopard

Saturday, 27th March, 2010

Snow Leopard ships with PHP 5.3.0, which at the time of writing, is quite recent (at least it’s a milestone version with a bunch of new features). I’ve not tried to install anything previously via PEAR on my Snow Leopard install.

When I tried to install PHPUnit, I ran into a problem:

$ sudo pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
$ sudo pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded
$ sudo pear install phpunit/PHPUnit
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, symfony/YAML, use --alldeps to download automatically
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version is 1.8.0
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1.2.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "symfony/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed

Oh noes! Time to upgrade PEAR. First check the PEAR channels are up-to-date:

$ sudo pear update-channels
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded
Updating channel "pear.phpunit.de"
Channel "pear.phpunit.de" is up to date
Updating channel "pear.symfony-project.com"
Channel "pear.symfony-project.com" is up to date
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded
$ sudo pear upgrade PEAR
downloading PEAR-1.9.0.tgz ...
Starting to download PEAR-1.9.0.tgz (291,634 bytes)
.............................................................done: 291,634 bytes
downloading Archive_Tar-1.3.6.tgz ...
Starting to download Archive_Tar-1.3.6.tgz (17,600 bytes)
...done: 17,600 bytes
downloading Structures_Graph-1.0.3.tgz ...
Starting to download Structures_Graph-1.0.3.tgz (30,191 bytes)
...done: 30,191 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.6
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.3
upgrade ok: channel://pear.php.net/PEAR-1.9.0
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

Now retry the install of PHPUnit.

$ sudo pear install phpunit/PHPUnit
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, symfony/YAML, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1.2.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "symfony/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
downloading PHPUnit-3.4.11.tgz ...
Starting to download PHPUnit-3.4.11.tgz (254,439 bytes)
.....................................................done: 254,439 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.4.11

We’re good to go.

Setting up aliases in Snow Leopard

Thursday, 25th February, 2010

Having trouble with Terminal not remembering your aliases? A lot of documentation on the web talks about configuring tcsh or csh in Mac OS X. I was scratching my head for a while wondering why my ~/.tcshrc file wasn’t defining my aliases on login (or my ~/.login file for that matter, that the system created!).

I started to wonder, how do I tell what shell I’m running under? You can find this out by checking in System Preferences » Accounts » Advanced Options (instructions).

Turns out I was running bash – I’ve not changed shell since installing Snow Leopard, so this must be the default. I can’t say I ever set up aliases in Leopard so I’m not sure if this was the default in previous OS X versions.

Create ~/.profile (I chmod 600 mine, read & write for my user only) and add aliases in the following format.

alias sshq="ssh -o 'StrictHostKeyChecking=no' -q"

Quit Terminal and when you open it again your aliases will be set up.

Intel X25-M First Impressions

Friday, 19th February, 2010

Two weeks ago I swapped out my Seagate Momentus 7200.2 160GB HDD for an Intel X25-M 80GB. I didn’t want to post my impressions prematurely so held out a couple of weeks.

I took the opportunity to upgrade to Snow Leopard at the same time – as I was performing a clean install of OS X anyway. First thing I did was move my user directory on to my second hard drive (a Seagate 7200.4 320GB), to redirect writes away from my SSD.

Intel X25-M SSD

So what to make of Intel’s SSD; well boot times have come down to a tidy 20 seconds, Skype starts a whole lot faster. Simultaneous reads are noticeably quicker (think concurrent application launches – particularly common at boot time). My Seagate drive was hovering around the 90 second mark with files (images) on the desktop (Mac OS X creates thumbnail previews). Overall though, and I don’t think I’m a particularly IO heavy user, so it’s a fairly subtle difference once booted.

I’ve 4GBs RAM in my Macbook Pro so I doubt I hit the swap file often. The biggest IO waits I experience are loading eclipse, loading Open Office, loading photoshop and performing multi-file searches in eclipse (~45,000 file project). The latter runs off my magnetic drive, so this contributes to a dulled performance increase.

I got this drive as birthday present, and although I’ve been drooling over SSDs since October, I’d have to say they’re still too expensive. If I had to buy this myself, I’d have held out for another price drop. Intel’s roadmap doesn’t show additions to their consumer SSD line until Q4 2010.

Ultimately, once manufacturers overcome the performance penalty of long term SSD write usage then I’d consider solid state disks all round, instead of a hybrid set up. For now, hold on to your wallet.

A real UK keyboard layout for Mac OS X 10.6 “Snow Leopard”

Wednesday, 17th February, 2010

Thanks to this blogger who made real UK keyboard layouts that work under Snow Leopard. I couldn’t get alternative community created UK layouts, that previously worked in Leopard, to work under Snow Leopard. They would never appear as a selectable layout in ‘Language & Text’ » ‘Input Sources’. Maybe because I tried to installed them under /Library/Keyboard Layouts instead of my user specific directory (~/Library/Keyboard Layouts). The author of the post admits he encountered the same problem.

I’m just relieved to have # ~ ” \ back in their rightful places. As a developer ALT+3 for # is like pulling teeth (thank god I don’t do much Perl programming!).

What’s that? Switch back to Windows? Never! :)

Changing User home directory under Mac OS X Leopard and beyond

Sunday, 31st January, 2010

Yesterday I finally got around to removing my flakey superdrive from my Macbook Pro and replaced it with an optical bay hard disk (OBHC) caddy (Google NewModeUS). This meant I was able to add another 320GB drive where my superdrive once lived (much needed as I was at 92% disk usage on my system drive). I also have an Intel X25-M 80GB to install but I’ll save that for a weekend when I have more time.

In preparation to moving to SSD, I’m looking to divert as many writes as possible, to prolong the performance of the drive (no TRIM support in OS X at present – no, not in Snow Leopard either). One of the best ways to do this is to migrate my user directory to my second (magnetic) hard drive. You might argue I’m losing the performance I paid for getting an SSD but boot times and applications launches should still benefit as the OS and apps reside on my X25-M.

<notice>Before proceeding with these instructions it’s vital you have a backup of your user directory and any other data on your Mac that you want to keep.</notice>

One of the top search results in Google for how to move / change your user directory in Mac OS X recommends using a symlink. There is however a cleaner method documented back in 2002 by Dan Frakes.

First, make sure that on the new volume, the “Ignore ownership on this volume” setting—in the volume’s Get Info window—is not checked

Open Terminal and enter:

$ sudo ditto -rsrc "/Users/greg" "/Volumes/newvolume/Users/greg"
$ sudo niutil -createprop / "/users/greg" home "/Volumes/newvolume/Users/greg"

The problem being that niutil no longer exists in OS X 10.5 (Leopard) and later.

$ niutil
-bash: niutil: command not found

In Leopard and later the NetInfo Manager has been replaced the Directory Services client (dscl). Since Mac OS X 10.4 ditto also has the -rsrc arguments enabled by default.

The commands you’re looking for under Leopard (and Snow Leopard) are (substitute your own username instead of ‘greg’, and here I’m moving my user directory to my second hdd/volume ‘Data’):

$ sudo ditto "/Users/greg" "/Volumes/Data/Users/greg"
Password: (enter password)
$ dscl
Entering interactive mode... (type "help" for commands)
 > cd /Local/Default/Users/
 > ls
 > change greg dsAttrTypeNative:home /Users/greg /Volumes/Data/Users/greg
 > exit

Logout and login again, verify your home directory has moved by opening Terminal and checking the public working directory:

$ pwd
/Volumes/Data/Users/greg

Now rename your old user directory to be sure, before removing it (or leaving it if you can afford the space):

$ cd /Volumes/OSX/Users/
$ mv greg greg.old

I rebooted after this to check my machine started up without any issues. Then removed my old user directory (sudo rm -rf greg.old).

Congratulations you’ve moved your user directory.

Update: When starting Eclipse, it could not locate my workspace but I only had to browse to my new user directory (/Volumes/Data/Users/greg). VirtualBox automatically updated the path to my images created with their wizard (presumably because they use a system variable for the path). The VDIs I had manually selected required my assistance to update their location in the Virtual Media Manager.

You are currently browsing greg's weblog archives in the Apple category.

Categories

xhtml 1.1 compliant   xhtml 1.1 compliant