Archive for category Mac OS X
Merging Keychains?
Posted by dAVE in General, Mac OS X, Tech. Support on 10/25/2006
Does anyone know how to merge multiple Keychains in Mac OS X?
I know I can copy items from one keychain to another, but that involves authenticating twice.
I tried going in and adding those other keychains to be part of my list, but they don’t stay. Frustrating.
Why am I doing this? I replaced my computer, and was not able to transfer my account at setup time, so I ended up with some old keychains that got copied over.
Suggestions, comments, rants?
All are welcome!
Dave
Mac OS X/mach: Identifying architecture and CPU type
Posted by stany in Consulting, Mac OS X, Rant!, Software, Tech. Support on 07/09/2006
Platform independent endinanness check:
#include <stdio.h>
union foo
{
char p[4];
int k;
};
int main()
{
int j;
union foo bar;
printf("$Id: endianness.c,v 1.1 2006/07/09 17:48:14 stany Exp stany $\nChecks endianness of your platform\n");
printf("Bigendian platform (ie Mac OS X PPC) would return \"abcd\"\n");
printf("Littleendian platform (ie Linux x86) would return \"dcba\"\n");
printf("Your platform returned ");
bar.k = 0x61626364;
for(j=0; j<4 ; j++)
{
printf("%c",bar.p[j]);
}
printf("\n");
return 0;
}
Platform dependent tell me everything check:
/*
* $Id: cpuid.c,v 1.2 2002/08/03 23:38:39 stany Exp stany $
*/
#include <mach-o/arch.h>
#include <stdio.h>
const char *byte_order_strings[] = {
"Unknown",
"Little Endian",
"Big Endian",
};
int main() {
const NXArchInfo *p=NXGetLocalArchInfo();
printf("$Id: cpuid.c,v 1.2 2002/08/03 23:38:39 stany Exp stany $ \n");
printf("Identifies Darwin CPU type\n");
printf("Name: %s\n", p->name);
printf("Description: %s\n", p->description);
printf("ByteOrder: %s\n", byte_order_strings[p->byteorder]);
printf("CPUtype: %d\n", p->cputype);
printf("CPUSubtype: %d\n\n", p->cpusubtype);
printf("\nFor scary explanation of what CPUSubtype and CPUtype stand for, \nlook into /usr/include/mach/machine.h\n\n
ppc750\t-\tG3\nppc7400\t-\tslower G4\nppc7450\t-\tfaster G4\nppc970\t-\tG5\n");
return 0;
Mac OS X: Getting things to run on platforms that are not supported
Posted by stany in Consulting, Mac OS X, Software on 07/09/2006
Purposefully oblique description, I know.
Basically there are two ways of not supporting a platform.
One way is to not support the architecture. If I compile something as ppc64, noone on a G3 or G4 CPU will be able to run it natively, nor will x86 folks be able to run it under Rosetta. I can try to be cute, and compile something for x86 arch, cutting off all PPC folks. I can compile something optimized for PPC7400 CPU (G4). G5 and G4 systems will run it and G3s will not (This is exactly what Apple did with iMovie and iDVD in iLife ’06). Lastly, I can compile something in one of the “depreciated” formats, potentially for Classic, and cut off x86 folks, and annoy all PPC folks who would now have to start Classic to run my creation. Oh, the choices.
The other way is to restrict things by the configuration, and check during runtime.
Procedure for checking that the architecture you are using is supported by the application.
bash$ cd Example_App.app/Contents/MacOS bash$ file Example_App Example_App: Mach-O fat file with 2 architectures Example_App (for architecture ppc): Mach-O executable ppc Example_App (for architecture i386): Mach-O executable i386
or
bash$ cd Other_Example/Contents/MacOS bash$ file Other_Example Other_Example: header for PowerPC PEF executable
Step 2a) If application is Mach-O, then you can use lipo to see if it’s compiled as a generic or as a platform specific:
bash$ lipo -detailed_info Example_App
Fat header in: Example_App
fat_magic 0xcafebabe
nfat_arch 2
architecture ppc
cputype CPU_TYPE_POWERPC
cpusubtype CPU_SUBTYPE_POWERPC_ALL
offset 4096
size 23388
align 2^12 (4096)
architecture i386
cputype CPU_TYPE_I386
cpusubtype CPU_SUBTYPE_I386_ALL
offset 28672
size 26976
align 2^12 (4096)
If you see CPU_SUBTYPE_POWERPC_ALL, application is compiled for all PowerPC platforms, from G3 to G5.
What you do not want to see on a G3 or G4 system is:
bash$ lipo -detailed_info Example_App
Fat header in: Example_App
fat_magic 0xcafebabe
nfat_arch 1
architecture ppc64
cputype CPU_TYPE_POWERPC64
cpusubtype CPU_SUBTYPE_POWERPC_ALL
offset 28672
size 8488
align 2^12 (4096)
Then you need a 64 bit platform, which amounts to G5 of various speeds.
It is possible that the application is in Mach-o format, but not in fat format.
otool -h -v will decode the mach header, and tell you what cpu is required:
Step 2b) If application is PEF (Preferred Executable Format) or CFM (Code Fragment Manager) things might be harder. I've not yet encountered a CFM or PEF app that would not run on PPC platform in one way or another, so this section needs further expantion. In case of a runtime check, most commonly it is the platform architecture that is checked. Some Apple professional software has something like this in AppleSampleProApp.app/Contents/Info.plist
AELMinimumOSVersion
10.4.4
AELMinimumProKitVersion
576
AELMinimumQuickTimeVersion
7.0.4
ALEPlatform_PPC
AELRequiredCPUType
G4
CFBundleDevelopmentRegion
English
Getting rid of
ALEPlatform_PPC
AELRequiredCPUType
G4
tends to get the app to run under G3.
Lastly, if application says something similar to “Platform POWERBOOK4,1 Unsupported”, maybe running strings on SampleApplication/Contents/MacOS/SampleApplication combined with grep -i powerbook can reveal something.
bash$ strings SampleApplication | grep POWER
POWERBOOK5
POWERBOOK6
-
POWERBOOK6,3
POWERMAC7
POWERMAC9,1
POWERMAC3,6
POWERMAC11,2
-
POWERMAC11,1
So if you want to run this application on 500Mhz iBook G3 for some reason (hi, dAVE), it might make sense to fire up a hexeditor, and change one of the “allowed” arches to match yours.
For example to this:
bash$ strings SampleApplication | grep POWER
POWERBOOK4
POWERBOOK6
-
POWERBOOK6,3
POWERMAC7
POWERMAC9,1
POWERMAC3,6
POWERMAC11,2
-
POWERMAC11,1
But don’t mind me. I am just rambling.
Personal Information and Apple
Posted by stany in Consulting, Mac OS X, Software, Tech. Support on 07/07/2006
If you did a clean install of MacOS X 10.4, part of out of box experience is filling out a bunch of things about what your name and address is, where you work, what your e-mail is, etc.
CMD-Q bypasses that screen, and continues as normal without asking for irrelevant information.
Thanks to Jon Rentzsch for the hint.
Video: DVD Studio Pro – I love you!
Spent a good chunk of today fighting with DVD creation. My previous attempt was using iMovie HD 6 and iDVD 6. Now, I have some issues with iDVD:
Suppose your projects are saved on an external drive, both iMovie and iDVD. You’d think that when you are rendeering the final DVD, it would still keep all the bits and pieces on the external drive, where the data is saved. Oh, no. iDVD is different. iDVD is smarter then the user, and will try to save the intermediate audio track (before the muxing) in /tmp If you have PCM audio track (and all of my previous projects did, because I didn’t know any better. Me Ogg. Ogg stoopid, remember?). Now, imagine that you are running out of disk space on your internal drive as it is, and then out of nowhere another 1.5 – 2 gigs of stuff show up in /tmp. Of course iDVD would die at this point.
iDVD 6 is also temperamental about DVD mastering, and was refusing to even think about creating a dual layer DVD (ie something longer then 4.7 gigs in size) if I didn’t have a dual layer burner plugged into the iBook. Fiar enough, I gave it the drive.
Then after running all night, it would die with a numerical error code (I’ve googled for it, noone saw it before). I tried three times, as originally I thought that I might have exceeded the “TV safe” area on the menu (another famous was of getting iDVD to die) with DVD title, or somesuch. But no, it just wouldn’t work.
So I got access to a machine with Final Cut Studio installed on it.
Oh, what a joy.
Software actuallly uses the location you tell it to use, without arbitrarily using what it should not. Software tells you what it thinks you should do, but lets you overrule it if you think you know better. Sane software.
I’ve plugged in my external hard drive, and imported into DVD Studio Pro DV streams which I used in iMovie and iDVD without much success before. It happily dealt with them.
Quickly I created a timeline. I’ve had everything pretty much pre-rendered, so it was as simple as setting a bunch of chapter breaks, creating a menu and linking the buttons to actions (ie Play chapter 1).
System I was using is an elderly G4 1.5 Ghz which was kind of skipping frames when dealing with large streams, and thus creating chapters was a bit of an excercise in patience. I’ve opened the iMovie project, and looked at places where I’ve placed chapter breaks before. In DVD studio I’ve created a bunch of chapter breaks arbitrarily, and then adjusted the times, so they would match more or less what I had in iMovie.
Worked as it was supposed to. Beautiful.
DVD Studio was telling me that my project would compress down to 5.1 gigs. At this point I thought that I should just do it, and then run it through DVD2OneX or somesuch, and shrink it down to 4.7 gigs, and told it to go ahead and just do it. It happily rendered to hard drive (it also asked me where I want to set layer breaks in dual layer disk, which was really nice too).
Eventually I realized that there is such a thing as Compressor, that can take a component of a multiplexed stream, and convert it to a different format.
After taking two 12 gig DV streams, and running them through Compressor, I’ve converted the audio tracks on both streams from PCM audio to Dolby 2.0 AC3.
Once I’ve imported the AC3 streams into DVD Studio Pro project, deleted the PCM audio from the timeline, and added in ac3 audio, projected project size dropped from 5.1 gigs to 4.1 gigs, and actual project size (once assets were rendered) dropped from 4.9 gigs to 3.6 gigs (I’ve used crappy video as DV source, from video tapes that were sitting in storage for god knows how long, so they compressed a fair bit).
So overall, I am really really happy with DVD Studio, although I’ve not used even 1/10′s of it’s capabilities. It can create HD DVDs. It can embed web links in mpeg files. It can edit existing menus. Now I need to save up my shekels to buy it (899 CAD for student license for Final Cut Studio).
How to get pictures off a Vivicam 55 under OS X
Grandpa got his grandson a $10 digital camera while they were on vacation, and I got annoyed at having to boot up the Thinkpad to get photos off of it.
Since Vivitar does not make drives for the Vivicam 55, and only made the 55B OS X compatible… I had to go do some digging to get it to work.
From Google groups I ended up in digital-products.info and grabbed 905C OSX10.4.zip. Inside are a PKG file, and a Quicktime component,
Copy the Quicktime component to /Library/QuickTime/, then install the PKG. Reboot. grumble.
Open Image capture or iPhoto.. and it works!
Anyone want 20 snapshots of the frame around our living room window?

“Clipboard Contents: A New Sensory perception”
Posted by dAVE in Mac OS X, Random Observations on 05/25/2006
It seems that Dan has hit upon a new form of sensory perception, particular to the computer age! He coined the term ‘Cliposeption’ for “the sense that there’s something on the clipboard.”
Maybe we can add on ‘Clipophobia’ to that? The fear that you just overwrote something important in the clipboard?
There is a related fear, which I get when I use Linux/UNIX, that of selecting something (usually the URL in the browser’s address bar) to delete it and paste in where I want to go, only to realize that I just over wrote my clipboard. ‘Selectoparanoia’?
I can add a phobia on to that as well: several of my clients refuse to remove Apple’s default items from their Dock. One person had been using their machine for almost 2 years, and when I showed them that those programs they never used could be removed (and replaced easily) so they could have a dozen fewer items in their Dock they got visibly upset.
Storage and power consumption costs
Lately I’ve been thinking more and more about storage. Specifically, at one point I’ve used a Promise 8 disk IDE to SCSI hardware RAID enclosure, attached to a Sun system, and formatted with UFS.
Hardware RAID 5 eliminated problems with losing data due to disk dieing in a fiery death. I bought 10 Maxtor 120 gig drives at the time, and dropped two on the shelf. Over course of about two and a half years I used two spare drives to replace the ones inside. Once it was a bad block, and the other time drive had issues spinning up. Solaris 8 had support for only one filesystem snapshot at a time, which was better then no snapshots at all, but not great. I’ve had a script in cron running once a week, that would snapshot whatever was there, and re-cycle each week. Not optimal, but it saved me some stress a couple of times, when it was late, I were tired, and put a space between wildcard and pattern in an rm command.
Last little while I’ve been trying to migrate to Mac OS X. Part of the reason was the cost of operation. I like big iron, and paying for an E4000 and an external storage array operating 24/7 was getting costly when one’s a student, as opposed to being a productive member of the workforce. I thought that it’s cheaper to leave an old G3 iBook running 24/7 – after all iBook itself only “eats” 65 watts, right? Generally I’ve turned off most of the other hardware – Cisco 3640 got replaced by a Linksys WRT54GS running openWRT, three other Sun systems got powered down, etc. At this point I’ve only had an iBook and an Ultra 2 running 24/7.
This is when I’ve hit the storage crunch: I were rapidly running out of disk space again, and I still needed occasional access to the data on the old Promise storage array.
Easy enough solution was to buy more external disk drives, place them in MacAlly USB2/FW external enclosures, and daisy chain them off the iBook. Somehow iBook ended up with over a TB of disk space daisy chained off it.
fiona:~ stany$ df -h Filesystem Size Used Avail Capacity Mounted on /dev/disk0s10 56G 55G 490M 99% / devfs 102K 102K 0B 100% /dev fdesc 1.0K 1.0K 0B 100% /dev512K 512K 0B 100% /.vol automount -nsl [330] 0B 0B 0B 100% /Network automount -fstab [356] 0B 0B 0B 100% /automount/Servers automount -static [356] 0B 0B 0B 100% /automount/static /dev/disk4s2 183G 180G -6.3G 104% /Volumes/Foo /dev/disk2s1 183G 182G -2.3G 101% /Volumes/Bar /dev/disk1s1 183G 183G -1.0G 101% /Volumes/Baz /dev/disk3s1 183G 174G -260.8M 100% /Volumes/Quux /dev/disk5s1 183G 183G -1.2G 101% /Volumes/Shmoo fiona:~ stany$
In process I’ve discovered how badly HFS+ sucks at a bunch of things – it will happily create filenames with UTF-8 characters, however it will not add things like accent grave or accent aigu to normal files. Migrating files with such filenames from UFS under Solaris ended up not simple – direct copying over NFS or SMB was failing, and untarring archives with such files was resulting in errors.
Eventually I’ve used a sick workaround of ext2fsx and formatted a couple of external 200 gig drives ext2. Ext2 under Mac OS blows chunks too – for starters it was not available for 10.4 for ages, and thus Fiona is still running 10.3.9 (Yes, I know that a very preliminary read only version of ext2fsx for 10.4 is now available. No, I don’t want to betatest it, and lose my data). ext2fsx would not support ext3, thus one doesn’t get any journalling. So if I accidentally pull on the firewire cable, and unplug the daisy chain of FW drives, I will have to fsck them all.
fscking ext2 under Mac OS is a dubious proposition at best, and most of the time fsck_ext2 will not generate an auto-mountable filesystem again. Solution to this was to keep a CD with Rock Linux PPC in the drive, and boot into linux to fsck.
I’ve cursed and set all the external drives to automount read-only, and manually re-mount read-write when I need to. Pain in the back side.
Lately I’ve been eyeing Solaris ZFS with some interest. Big stopping point for me was the migration of the volume to a different system (be that same OS and architecture, or different OS and architecture all together). Turned out that migrating between Solaris systems is as simple as zfs export volumename, move disks to different system, zfs import volumename, which is a big win. Recently there were rumors that Linux folks and Apple folks are porting or investigating porting of ZFS to Linux and Mac OS X (10.5?), which gives hopes to being able to migrate to a different platform if need be.
All of that made ZFS (and by extention Solaris 10) a big contender.
It didn’t help that each of the external drive power supplies is also rated at 0.7 amp. One watt is one ampere of current flowing at one volt, so here I am with 3.5 amps. 65 watts that Apple iBook power adapter is rated for is only about 2/3 of the actual amperage, as it also generates heat, so here is another 0.7 amp or more. Oh, and there is the old Ultra 2, that, according to Sun consumes another 350 W, and generates 683 BTU/hr. So, assuming that Sun actually means that it consumes 350 W, and not that the power supply is rated for 350 W, that’s another 3.2 Amps of load.
This adds up to ~7.5A/hr 24/7.
This is where I get really confused while reading Ottawa hydro bills.
Looking at Ottawa hydro rates page, I read:
Residential Customer Rates Electricity* • Consumption up to 600 kWh per month $0.0580/kWh • Consumption above the 600 kWh per month threshold $0.0670/kWh Delivery • Transmission $0.0095/kWh • Hydro Ottawa Delivery $0.0195/kWh • Hydro Ottawa Fixed Charge $7.88 per month Regulatory $0.0062/kWh** Debt Retirement $0.00694/kWh***
Thus, some basic math shows that:
7.5 amps * 110 volt = 825watts/hr
600kW/hr that Ottawa hydro is oh so generously offering me adds up to 600,000 watts / 31 days / 24 hours = ~806 watt/hr
In other words, I am using up the “cheap” allowance by just keeping two computers and 5 hard drives running.
825 watt/hr * 24 * 31 = 613.8kW/hr
Reading all the Ottawa Hydro debt retirement (read: mismanagement) bullshit, I get the numbers of
6.7 cents + 0.694 cents + 0.62 cents = 8.014 cents/kWh.
613.8kWh * 8.014 cents/kWh = 4919 cents = 49.19 CAD/month
Now, assuming that I were paying 5.8 as opposed to 6.7 cents kWh, it would still be 613.8kWh * 7.114 cents/kWh = 43.66 CAD/month.
Not a perty number, right?
So I am asking myself a question now…. What should I do?
I have two large sources of energy cosumption – external drives (I didn’t realize how much power they draw) and Ultra 2. iBook on it’s own consumes minimal power, and thus is at most about 10$/month to operate.
Option number one – turn off everything, save 50 bucks a month.
Option number two – leave everything running as is, swallow the “costs of doing business”
Option number three – Turn off Ultra 2, average savings of 22$/month, lose my e-mail archives (or migrate pine + e-mail to the iBook). Continue living with frustrations of HFS+.
Option number four – Migrate mail from Ultra 2 to iBook. Turn Ultra 2 off. Migrate all of the drives into the Promise enclosure (how much power it consumes I honestly don’t know until I borrow from somewhere a power meter – Promise is not listing any information, and neither is there any on the back of the thing), hook it up to iBook over RATOC SCSI to Firewire dongle. This will give me somewhere between 1.5 and 2 TB of storage, HFS+ or ext2 based. If I decide to install Linux or FreeBSD on iBook, well, the more the merrier.
Option number five – Migrate all of the drives into the Promise enclosure, hook it up to Ultra 2, turn off (or do not – on it’s own it’s fairely cheap to operate) remaining iBook. Power consumption will remain reasonably stable (I hope. I still have no idea how much power Promise thing consumes. It might be rated for 6.5 amps on it’s own). I could install latest OpenSolaris on Ultra 2, and format the array using ZFS. No costs savings, lots of work shuffling data around, but also has tons of fringe benefits, such as getting back up to date on the latest Solaris tricks.
I’ve just looked at specs for all the Sun system models that I own (Ultra 2, Ultra 10, Ultra 60 and E4K), and seems like U2 consumes the least power out of the bunch. Ultra 10 is rated for the same, but generates twice as much heat. Adopting Ultra 10 for SCSI operation is not that hard, but would force me to scrounge around for bits and pieces, and dual 300mhz US II is arguably better then a single 440mhz US IIi.
I guess there is also an option number 6 – Replace Ultra 2 with some sort of low power semi-embedded x86 system, with a PCI slot for a SCSI controller, and hook up Promise array to it. Install OpenSolaris, format ZFS, migrate data over. Same benefits as Option 5 with additional hardware costs, and having to use annoying computer architecture.
I guess I will have to decide soon.
Update: Promise UltraTrak100 TX8 is rated for 8 amps at 110 volts (4 amps at 220 volts)
iLife 06 and G3 processor and rant about Pacifist.app
After cobbling together an iBook (long story, but iBook in question is 600Mhz G3 with 100Mhz bus (as opposed to 600Mhz with 66Mhz bus that would make it much closer to molasses) 40 gig HD and combo drive), and throwing a clean install of 10.4.5 onto it today, I proceeded to turn it into a master disk image.
Every once in a blue moon I create an up to date install of OS with all the apps, system configured how I like it, accounts set up as I like them, and then use asr to back them onto an external hard drive. Then, in event I need to quickly roll out a system or recover from disaster I’d just need to asr the image back.
Two words about asr. Personally, I love asr. It can act as a poor man’s backup tool to create an identical bootable disk on a different drive (especially useful if you have some sort of bootable CD/DVD from which you can boot, as then asr would use fast block copy to copy data from disk to disk). Coincidentially, vast majority of macs (Let’s not talk about x86 ones. I am not yet sure I like them) supports firewire disk target mode. asr is also useful in creating and restoring from disk images.
Sadly for things like recovery disk I tend to use junky drives, as it’s not really a priority, just convinience, and coincidentially there is no funding for it. A disk with my last image died, so I decided to take advantage of the opportunity, as I were setting up a new system from scratch, with no baggage of software archeologies.
When I put in iLife 06 DVD into iBook and attempted to install it, I were told that iLife 06 only works with G4 and up processors.
So not being deferred, I’ve used Pacifist (See rant about Pacifist at the bottom) to extract iMovie package into a folder, to see what it is that Apple is trying to do on me.
I’ve talked about Fat files and lipo earlier, in case you feel like a review.
So a quick check with lipo confirmed what Apple is saying…. the compiled the binary for G4 and x86 processors only, obsoleting G3s. *sigh* First the cut off was presence of Firewire, then with iWork 05 (which was like 650 megs, yet shipped on DVD) it was presence of DVD, but now it’s G4 and up. I got to give a credit to the marketing/built in obsolescence people at Apple – they are good!
stany@Ghostwheel:~/Desktop/Root/Applications/iMovie HD.app/Contents/MacOS[03:46 AM]$ lipo -detailed_info iMovie\ HD
Fat header in: iMovie HD
fat_magic 0xcafebabe
nfat_arch 2
architecture i386
cputype CPU_TYPE_I386
cpusubtype CPU_SUBTYPE_I386_ALL
offset 4096
size 3217924
align 2^12 (4096)
architecture ppc7400
cputype CPU_TYPE_POWERPC
cpusubtype CPU_SUBTYPE_POWERPC_7400
offset 3223552
size 3327624
align 2^12 (4096)
stany@Ghostwheel:~/Desktop/Root/Applications/iMovie HD.app/Contents/MacOS[03:46 AM]$
7400 is, of course, G4.
Attempts to run it generate ldynamic linker errors:
stany@Ghostwheel:~/Desktop/Root/Applications/iMovie HD.app/Contents/MacOS[03:46 AM]$ ./iMovie\ HD dyld: incompatible cpu-subtype Trace/BPT trap stany@Ghostwheel:~/Desktop/Root/Applications/iMovie HD.app/Contents/MacOS[03:54 AM]$
Now a quick rant about Pacifist.
Dear Charles Srstka.
I like Pacifist. I’ve not registered it using a pirated serial, and see 15 second time out each time I start it. One of these days I’ll even send you some money to support your effort (which seem to have been stalled since 2004). But, can you give me an answer to one question: Why the heck does Pacifist ask for administrator password each time one attempts to extract a file out of a package? Shouldn’t it only do that if one doesn’t have write permissions to the folder one is extracting files into? If I have read/write rights to files in package and to Desktop onto which I want to extract package’s contents, why does Pacifist want my password? Isn’t that getting users used to Pavlovian response of typing in admin password every time there is a prompt on screen, regardless of the need?
Please, think of the users, esp in view of the recent series of Mac OS worms that also ask for admin passwords.
Damn, if you fix it to actually check (and tell user why) if it needs admin password, and e-mail me about it, I’ll buy a license for Pacifist.
DYLD_LIBRARY_PATH
Anyhone has any clue why vast majority of the dynamic linkers out there (Solaris, Linux, BSD etc) all use LD_LIBRARY_PATH variable to specify where to load dynamic libraries from, yet Darwin/MacOS X uses DYLD_LIBRARY_PATH?
*grumble*
Compiling Alladin GhostScript 8.51 from source. It’s not hard, just quirky. Oh, and jpgsrc-6 and zlib-1.2.2 both need a config.sub from a recent package for configure to recognize Darwin/MacOS X.