Monday, June 29, 2009

Rocking the Mac Terminal

For the system administrator

Shutdown:shutdown now

Restart:shutdown -r now

Install all updates:sudo softwareupdate -i -a



Install only recommended updates


sudo softwareupdate -i -r



Other cool links




Friday, March 27, 2009

Eject or boot from a CD or DVD at startup

To eject a disc that won’t pop out if you try to eject it in the Finder (Cmd-E):



  1. turn on or restart the Mac


  2. hold down the Eject button on the keyboard (Apple keyboard required, of course).

To boot from a CD or DVD that you’ve inserted while the Mac is running:


  1. select Restart from the Apple menu


  2. hold down the “C” key as soon as the Mac restarts.

You can let go as soon as the little rotator appears under the apple icon.

If you don't want to restart, you can open the terminal and enter:

disktool -l

Find the disk number for the CD or DVD (probably disc2, but it is disk3 on my MacBook Pro) and then enter:

disktool -e disk#



where # is the number of the CD or DVD

Saturday, December 27, 2008

Mac AntiVirus: ClamXav.com

ClamXav is a free anti-virus package for Mac OS X which, as of today, supports Jaguar (10.2) through Leopard (10.5). VU versions for Jaguar and Panther (10.2 and 10.3) are unsupported, but Tiger and Leopard are actively maintained, Universal Mac applications. Go to the ClamXav Download Page to get your version.

I liked this flavor of antivirus for the Mac because it is based on the ClamAV open source antivirus toolkit for UNIX. You can learn more about the Clam AntiVirus toolkit from their website, and this is a standard option in most Linux distributions.

After you download the disk image file, simply drag the ClamXav application to your applications folder and run it from your hard disk. The first time you run the program, it will ask to install the ClamAV Antivirus engine. After you run the separate installer, you’ll need to start the program again. Take a moment to update the virus definitions, and then run a scan on any folder or volume on your Mac.

Sunday, December 21, 2008

Super-Clean Screenshots

From Apple, a great tip:

Super-Clean Screenshots

capture an image of your entire screen by typing Command-Shift-3. Typing Command-Shift-4 lets you choose a specific part of your screen to save as a screenshot ... Hold down the Command, Shift, and 4 keys, then press the Spacebar ... move [the] camera icon over the element you’d like to capture, that element is highlighted. Click your mouse or trackpad, and you’ve captured a screenshot of just that element — no further cleanup required.


Perhaps we'll see some more screen shots here on the blog...

Sunday, November 02, 2008

Move Time Machine Backups to a New Volume

I used up all the room on my 160 GB Time Machine volume, so I picked up a Western Digital My Book Essential Edition 1 TB Hard Drive to increase my backup capacity.

How do I transfer my existing Time Machine backup from the old, maxed-out disk to the new one? I'm running Mac OS X 10.5 Leopard; the steps might be different for other versions of OS X.

As it turns out, you can't just drag your old Time Machine backups to the new disk using a Finder copy. Time Machine creates all kinds of "hard links" to the files that aren't changed. If you just copy these files in the Finder, you'll create full copies of all the links, ballooning the size of your backup exponentially. Instead, you need to use a Block Copy operation. This requires that you completely erase the new drive as part of the copy procedure.

Here's an overview of the steps I followed to transfer my Time Machine backups. Note that I use both "drives" and "volumes" to refer to logical disk drive volumes.
  1. Ensure that the system isn't trying to work with your Time Machine drives.
    • Turn off Time Machine & stop using the original drive for backups.
    • Tell Spotlight not to index your Time Machine drives.
  2. Perform a Block Copy of your original Time Machine database to the new drive.
  3. Tell Time Machine to use the new drive as the Time Machine backup drive.
It took me a while to get this to work, as I ran into some permissions issues. To start, I found this tip for Mac OS X 10.5: Move Time Machine backup to another drive, which recommended using a Disk Utility Restore to copy the data. Unfortunately, I get the message:
Could not restore - Operation not permitted
even with Time Machine turned off. It looked like the Mac was trying to access the new drive while I was doing the backup. So, I turned Time Machine off completely, using these steps:

Deactivate Time Machine
  1. Open Time Machine Preferences.
  2. Turn Time Machine OFF using the slider switch.
  3. Click [Change Disk...].
  4. Select None.
  5. Click [Use for Backup]
These steps will prevent Time Machine from trying to access the drive at any time during the (potentially) lengthy period it requires to move your data.

I also recommend turning of Spotlight indexing for the Time Machine drives (not a bad idea in general, because you really don't need to index the backups with both Time Machine & Spotlight).

Turn off Spotlight Indexing for your Time Machine drives
  1. Open Spotlight preferences (System Preferences > Spotlight).
  2. Select the Privacy tab.
  3. Add your Time Machine disks to the Prevent Spotlight from searching these locations list box using the Add (+) button in the lower left, or dragging the disk icon from the Finder to the list box.
[Antonio notes in the comments: Boot from the Leopard DVD so you can perform all of the following steps without having to make of the any adjustments to Spotlight described above.]

Block Copy the Time Machine Backups using Disk Utility Restore

I used the Disk Utility Restore feature to move my data. It failed the first few times because I neglected to erase the destination disk, to allow Disk Utility to use Block Copy mode. Here's how to do it:
  1. Open Disk Utility.
  2. Select the original Time Machine volume.
  3. Click the Restore tab.
  4. Drag the icon for the original Time Machine volume to the Source: field.
  5. Drag the icon to for the new Time Machine volume to the Destination: field.
  6. Click Erase destination -- this is important because it addresses the permissions issues that plagued me, and also allows Disk Utility to use a block copy mode.
  7. Click [Restore].
Note that you'll need to authenticate to perform these steps. The end result: it took about 7 and a half hours to restore 150 GB of data on my 2.4 G Hz MacBook Pro. More than half of this time was the verification pass. Also, the name of the source volume was applied to the destination, which was a little confusing.

Now, it's time to point Time Machine at the new drive.
  1. Open Time Machine Preferences and authenticate, if required.
  2. Click [Choose Backup Disk...].
  3. Select the disk you prepared (I renamed it with a more descriptive name).
  4. Click Click [Use for Backup].
  5. Confirm the Time Machine slider is set ON.
I selected a folder that has had lots of changes, and opened the Time Machine "lost in space" interface: it's got backups for the last six months -- it looks like it worked.

Carbon Copy Cloner

I took a close look at the comments on the tip Move Time Machine backup to another drive and it looks like Carbon Copy Cloner (CCC) is another option. Since the Disk Utility approach didn't work the first few times, I also tried using CCC to copy the data via block mode.

Here's what I did in Carbon Copy Cloner 3.1.2
  1. Selected the old Time Machine volume as the Source Disk.
  2. Selected the new Time Machine volume as the Target Disk.
  3. For Cloning options:, select Backup everything,
  4. Check Delete itmes that don't exist on the source (this is required to use block-copy mode, which is recommended). Note that this also erased today's Time Machine backup from the new volume, but that's not a problem.
  5. Click [Clone].
Now it's time to do something else, as this process is going to take quite a while. In fact, it didn't work at all: I checked the CCC Log and everything was failing, and CCC was using rsync to move the data, not block mode. So, I canceled, and instead used Disk Utility with the Erase destination option, as described above.

I never got a chance to try Super Duper, which is highly recommended for block copy operations such as the one I just completed. If you've used Super Duper to transfer your Time Machine database to a new volume, successfully or not, please post a comment with the results of your transfer.

Other Resources
Update

Geordie comments below that he couldn't get these steps to work on OS X 10.5.6 when trying to move from a 250GB LaCie disk to a 1 TB Iomega disk, using Apple's Disk Tools, but succeeded with Super Duper .

Wednesday, September 17, 2008

Freemind on the Mac, and converting to OPML

I wrote last year about a great open source brainstorming and mind mapping tool, Freemind 0.8.0 - Java Mind Map software, but I was concerned that the program hadn’t seen a significant update in several years. Well, it’s just been updated this year to 0.8.1, and you can download it from SourceForge.net: FreeMind. Version 0.9.0 is still an unstable beta, and not readily available

As a Mac guy, I’m interested in Importing/exporting to FreeMind from my favorite outliner program, OmniOutliner. I started by downloading version 0.8.1 from 2008-01-26, as a Mac OS X .dmg file, which is the most recent version of the program available as a DMG file.

Next, it’s time to run XSLT transformations on the Mac. Some XSLT resources:

The Tao of Mac - Resources led me to XSLT Tools Scripting Addition. I downloaded their XSLT Tools. I also looked at AquaXSL, from Scandalous Software - Mac XML Tools by Todd Ditchendorf, which is not suitable for bulk transformations, but demonstrated that I could take a FreeMind document, convert it to OPML, and open it in OmniOutliner.

I can script this using Automator: Transforming a Shell Script into an Automator Action using the xsltproc tool, or I can just do it from the command line, like this:

xsltproc --verbose --output output-file.opml /Applications/FreeMind/accessories/mm2opml.xsl inputfile.xml

Note that xsltproc doesn’t care what the file names or extensions are, either.

Now I’m getting greedy: I’d like to use these tools to connect FreeMind to OmniFocus. Answers to the question Export to omni outliner? led me to some AppleScripts that might help: Omnifocus to Omnioutliner Pro exporter and Create an OPML version of the Omnifocus database, or Curt Clifton | Software offer some export scripts for OmniFocus.

These tools are useful for anyone who uses mind mapping software that supports OPML, including NovaMind Pro Mind Mapping Software.

Saturday, July 26, 2008

iMac G5 Death Throes

The iMac G5 named iFive, which I boot without a keyboard, is in its death throes: it crashed again while booting up. Power supply issue? This time, I could save the report to Apple. Reporting didn't work until I plugged in a USB mouse.

So, here it is:

Unresolved kernel trap(cpu 0): 0x300 - Data access DAR=0x0000000000000038 PC=0x000000000005FDD8
Latest crash info for cpu 0:
Exception state (sv=0x4DE32280)
PC=0x0005FDD8; MSR=0x00009030; DAR=0x00000038; DSISR=0x40000000; LR=0x0005DEB4; R1=0x1CEF3C70; XCP=0x0000000C (0x300 - Data access)
Backtrace:
0x02C9E424 0x00062538 0x00063344 0x000A865C 0x000ABB80
backtrace terminated - frame not mapped or invalid: 0xBFFFF890

Proceeding back via exception chain:
Exception state (sv=0x4DE32280)
previously dumped as "Latest" state. skipping...
Exception state (sv=0x4DCCEC80)
PC=0x8FE23CE8; MSR=0x0000D030; DAR=0x8FE49424; DSISR=0x40000000; LR=0x8FE23CA4; R1=0xBFFFF890; XCP=0x0000000C (0x300 - Data access)

Kernel version:
Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC
panic(cpu 0 caller 0xFFFF0003): 0x300 - Data access
Latest stack backtrace for cpu 0:
Backtrace:
0x000954F8 0x00095A10 0x00026898 0x000A8204 0x000ABB80
Proceeding back via exception chain:
Exception state (sv=0x4DE32280)
PC=0x0005FDD8; MSR=0x00009030; DAR=0x00000038; DSISR=0x40000000; LR=0x0005DEB4; R1=0x1CEF3C70; XCP=0x0000000C (0x300 - Data access)
Backtrace:
0x02C9E424 0x00062538 0x00063344 0x000A865C 0x000ABB80
backtrace terminated - frame not mapped or invalid: 0xBFFFF890

Exception state (sv=0x4DCCEC80)
PC=0x8FE23CE8; MSR=0x0000D030; DAR=0x8FE49424; DSISR=0x40000000; LR=0x8FE23CA4; R1=0xBFFFF890; XCP=0x0000000C (0x300 - Data access)

Kernel version:
Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC
Model: PowerMac8,1, BootROM 5.2.2f2, 1 processors, PowerPC G5 (3.0), 1.6 GHz, 768 MB
Graphics: GeForce FX 5200, GeForce FX 5200, AGP, 64 MB
Memory Module: DIMM0/J4000, 256 MB, DDR SDRAM, PC3200U-30330
Memory Module: DIMM1/J4001, 512 MB, DDR SDRAM, PC3200U-30330
Modem: Jump, V.92, Version 1.0
Network Service: Built-in Ethernet, Ethernet, en0
Serial ATA Device: ST3300620AS, 279.46 GB
Parallel ATA Device: MATSHITACD-RW CW-8123
USB Device: General Purpose USB Hub, Up to 12 Mb/sec, 500 mA
USB Device: External HD, Iomega, Up to 12 Mb/sec, 500 mA
USB Device: USB Device, Up to 12 Mb/sec, 500 mA
USB Device: Kensington USB/PS2 Wheel Mouse, Kensington, Up to 1.5 Mb/sec, 500 mA