Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
13,000 hints and counting!

Control+T in Terminal shows time snapshot UNIX
Not sure if this was available before 10.7, but hitting Control+T while running a command in the Terminal will show what process is executing, the load, the PID of the process and its user and kernel time.

I was running a script and accidentally hit Control+T instead of Command+T to create a new tab. I was surprised at what I got. Here is an example of what gets printed:
# buildOrder.py
load: 2.51  cmd: p4 15179 running 0.00u 0.00s
load: 2.23  cmd: p4 17962 waiting 0.01u 0.00s
load: 2.53  cmd: Python 15167 running 94.68u 66.33s
load: 2.60  cmd: Python 15167 running 150.71u 101.82s

[crarko adds: I wasn't able to reproduce this, but it may be due to the briefness of the running command. Give it a try and post a comment about your results. Try it in Snow Leopard too if you can.]
  Post a comment  •  Comments (10)  
  • Currently 5.00 / 5
  You rated: 5 / 5 (3 votes cast)
 
[306 views] Email Article To a Friend View Printable Version
10.7 : Enable Recovery HD after restore from Time Capsule/File Vault 2. System 10.7
File Vault 2 and embedded 'Recovery HD' disk are new additions to OS X in Lion release.  

A fresh OS X Lion installation creates 'Recovery HD' by live re-partitioning 'Macintosh HD'. The recovery disk is 650MB in size (as of 10.7.2), of partition type Apple_Boot, and therefore, will be hidden during normal usage by OS X user interface. It does not show up in Finder, and not even 'Disk Utility.'

If the recovery disk 'Recovery HD' is proper, booting up a Mac without File Vault 2 while holding down the Option key will result in listing 'Recovery HD' as an alternative to 'Macintosh HD' for booting the machine up. For Macs with File Vault 2, only holding down the Cmd+R key combination will boot 'Recovery HD.'

The 'Recovery HD' of a Mac without File Vault 2 contains 'Base System Install', which is a minimal OS X kernel plus useful utility applications (Disk Utility, Time Machine, Network Utility, Pasword Utility). The main purpose is to allow partitioning a hard disk and restoring the system from a Time Capsule via the Time Machine application.

The 'Recovery HD' of a Mac with File Vault 2 does not contain 'Base System Install,' but only CoreStorage components and a minimal kernel for authenticating a user to Core Storage, to get a File Vault 2 (Whole-Disk-Encryption) protected disk mounted. Therefor, once File Vault 2 is turned on, your Mac will loose the ability to boot 'Base System Install'. The only way to start a Time Capsule restore is to boot from a Lion Installation DVD (or USB), if you had one made from the downloaded Lion installation app from the AppStore (instructions are widely written in web articles, please search the web).

When a Lion Mac is restored from Time Capsule via the Time Machine application, as of 10.7.2, the 'Recovery HD' will NOT be recreated. A Mac with File Vault 2 previously enabled will also be restored with File Vault 2 disabled; i.e. the disk will NOT be encrypted (this is right thing to do IMO). Without 'Recovery HD', File Vault 2 cannot be enabled anymore. This is a BIG problem for Mac owners who need stronger assurance of data security.

This article is a collection of my experiences in fixing this plight I had to face after restoring my Mac after my Seagate Momentus 500GB (G-Shock) crashed badly.

As with everything related to direct disk manipulations, here is an important disclaimer: The suggestions here are merely suggestions that may work, complete data loss may result, the risks are yours and only yours to bear. Please do not do anything I said if you are not willingly to bear all consequences.

First, let's be clear - if you had not backed up your 'Recovery HD' all bets are off for a quick and easy fix.

How to backup 'Recovery HD'

Apple has released the Recovery Disk Assistant that will help create a backup of 'Recovery HD' on a USB Disk, *provided* that your 'Recovery HD' is healthy. Unfortunately, tthere is no documentation on what is healthy. It turns out that here is a wisdom that I learned through the ordeal : If you intend to enable File Vault 2, perform backup of 'Recovery HD' TWICE, i.e. get yourself two 1GB USB Disk. Do the first backup before you turn on File Vault 2 to keep a copy of 'Recovery HD' with 'Base System Install'. Do a second backup after you turn on File Vault 2 to keep a copy of 'Recovery HD' which contains Core Storage aware mini kernel to mount your encrypted disk.

The one you need to restore 'Recovery HD' is the first backup (made before File Vault 2 enabled).

What if you had done neither? Based on three days of experimentation with a few different Macs, the following exceptions may save your day: make a backup from any Mac with OS X Lion 10.7.2 that does not have File Vault 2 enabled. It worked for me, but Apple said you should not do this; please weigh the risks yourself. The worst consequence here is that you will not be able to boot 'Recovery HD' or it does not appear as boot choice.

WARNING: Do NOT use a backup of 'Recovery HD' from other Mac that has File Vault 2 enabled.

CASE 1) You bought your Mac with OS X Lion

If your Mac get serviced by Apple and the hard disk got replaced, if you had OS X Lion when you first purchased the Mac, the new hard disk will have 'Recovery HD'. Make a backup of your 'Recovery HD'  before you proceed to restore from Time Capsule. You will still have 'Recovery HD' after restoring from Time Capsule.

CASE 2) Clean-install minimal OS X, Restore from Time Capsule

If you read this far and cannot get yourself a copy of backed-up 'Recovery HD', here is the only remaining alternative for you to get back 'Recovery HD' so that you can enable File Vault 2 after that:
  • First, get or make yourself a 'OS X Lion Install' DVD or USB. This is very important.
  • Do a minimal OS X installation, i.e. install the bare minimum by customizing your installation. This force the creation of 'Recovery HD'
  • Once installation complete, you can boot up from 'Recovery HD' (hold down Option or Cmd+R during boot). Then choose restore from Time Capsule.
CASE 3) Partition hard-disk, restore 'Recovery HD' from backup, restore from TimeCapsule:

Here is a short-cut to get your 'Recovery HD' back if you have a backup copy, and comfortable with command line interface.

a. First, get or make yourself a 'OS X Lion Install' DVD or USB. You will need this. If your Mac get serviced by Apple and the hard disk got replaced with earlier OS X version, but you had upgraded to OS X Lion prior to servicing, then, create a temporary account, do software update to the latest OS X version, sign on AppStore, re-download your copy of OS X Lion, make a 'OS X Lion Install' DVD.

b. Boot up 'OS X Lion Install DVD / USB' (not backed-up 'Recovery HD' USB).

c. This step is going to re-partition your harddisk, everything will be lost, be warned!

Choose Disk Utility. Click on disk containing 'Macintosh HD', on the right pane, click on partition. Under 'Partition Layout', pull down and select 2 partitions. Click on the bottom parition, on the right pane, enter 'Recovery HD' for name, 'Mac OS Extended (Jorunaled) for 'Format', 1GB for size (need only 0.65GB). Click on top partition, 'Macintosh HD' for 'Name', accept default for size, 'Mac OS Extended (Jorunaled) for 'Format'. Click on 'Apply'. Once done, quit Disk Utility (Cmd-Q) to return to install menu.

d. This step is going to modify the GPT partition table of your Mac's hard disk. Usually very RISKY, but at this point, you are recovering and data is safe in Time Capsule, so, risk is lesser, but still you have been warned!

Click on 'Utilities' on the menu bar, then click on Terminal.

Notes: You will need to use this command very often 'diskutil unmountDisk disk0' (case sensitive). The right angle bracket '>' indicate the commands you should enter. Depending on your disk size, the numbers under columns 'start' and 'size' should be all different from what are shown.
> diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *90.0 GB    disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS OSXviiSSD               89.0 GB    disk0s2
   3:                  Apple_HFS Recovery HD             1.07 GB    disk0s3

Note: The last line for yours read 1.x GB, it is okay. How exact is not important.
> diskutil unmountDisk disk0
> gpt show disk0

      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  310902592      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  311312232    1269544      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
	...

> diskutil unmountDisk disk0

> gpt remove -i 3 disk0

> diskutil unmountDisk disk0

> gpt add -i 3 -s 1269544 -t %Apple_Boot% disk0
-OR-
> gpt add -i 3 -s 1269544 -t %426F6F74-0000-11AA-AA11-00306543ECAC% disk0

> diskutil unmountDisk disk0
> gpt show disk0

      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  310902592      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  311312232    1269544      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
	...

> diskutil unmountDisk disk0
> gpt  -l Recovery\ HD disk0s3

> diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *90.0 GB    disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS OSXviiSSD               89.0 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

Now, mount your backed-up 'Recovery HD' USB. Wait a couple of seconds.
> diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *90.0 GB    disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS OSXviiSSD               89.0 GB    disk0s2
   3:                 Apple_Boot                         650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *1.0 GB     disk1
   1:                 Apple_Boot Recovery HD             650.0 MB   disk1s1

Mine is mounted as disk1. Depending on how many HDD is in your Mac, it may be different. So, do carefully identify the right disk number! You have been warned!
>  dd if=/dev/disk1s1 of=/dev/disk0s3 bs=32768

This command is the reason why you should not boot from the 'Recovery HD' backup; you cannot 'dd' from a mounted volume. If you follow and get this far without hiccups, things are working out for you. If things do not work out, please remember you can do CASE 2 method.

So, did it work? Reboot, press 'Option' and see if 'Recovery HD' appears; then pick it, and see if 'Base system Install' booted (should look the same as when you booted from DVD / USB).

f. In this step you will restore your Mac from the Time Capsule.

Congratulations if you got back 'Recovery HD' and you are ready to restore from Time Capsule.

g. Once you finished restoring and rebooted, check if 'Recovery HD' is really good.

Download 'Recovery Disk Assistant' from Apple, install it, and open the application. If it does not complain about 'Recovery HD' being corrupted, mission accomplished.

h. Make a backup of your 'Recovery HD'. This copy is made before turning on File Vault 2.

i. Do Time Machine backup on your restored Mac before turning on File Vault 2.

j. Enable File Vault 2.

[crarko adds: OK, there are so many caveats here I'm not sure where to start. I would strongly urge anyone trying this to first vet the process on a test machine with no vital data. There are a lot of places where things could go wrong and doing it once when you can afford to rebuild the system from scratch if they do can be a lifesaver.

If you can't try this on a test machine, and need to do this kind of recovery, you may want to seriously consider hiring a professional for the task.

Also please note that I did fairly minimal editing of the recovery steps, since I didn't want to introduce any errors into the procedure. Please forgive any grammatical slips which have resulted from this.]
  Post a comment  •  Comments (2)  
  • Currently 3.00 / 5
  You rated: 3 / 5 (1 vote cast)
 
[232 views] Email Article To a Friend View Printable Version
iOS 5: iPad show mailbox gesture iOS devices
Maybe everybody already knows this, but I missed it in all the new features of iOS 5. The iPad mail app adds a new gesture to show and hide the message list window when in portrait orientation.

I always use my iPad's Mail app in landscape mode because I get to see my message list in addition to the message detail. And for some reason, I find it tedious to push the mailbox button at the top left of the screen to see the message list. iOS 5 added the ability to swipe right anywhere on the message window to pop up the message list and to swipe left to hide it again. Nice! Not having to move my finger six inches has somehow made portrait mode much more bearable for me.

[crarko adds: Well, I didn't know it either, so here's the hint. I also was a landscape mode only iPad mail user.]
  Post a comment  •  Comments (2)  
  • Currently 3.50 / 5
  You rated: 1 / 5 (4 votes cast)
 
[481 views] Email Article To a Friend View Printable Version
A Spotlight Plugin for InDesign Apps
Every now and then I poke around the web to see if someone has found a way to search InDesign files with Spotlight. For many users of InDesign, this missing capability has been a point of frustration since Spotlight was introduced with Tiger back in April of 2005. Now there's a little something for anyone running InDesign CS5 or CS5.5.

Over in the Adobe forums, John Hawkinson put together a plugin. He recommends installing it, then using Terminal to re-index specific files or folders using:

mdimport /Users/UserName/Path/To/File/Or/Folder

I installed the latest version of his plugin (version 0.1c) into ~/Library/Spotlight then ran the mdimport command on my Documents folder. While he's explicit that this is alpha software, I've seen no issues and it seems to work very well. Thanks, John!

[crarko adds: A big help for a fairly significant omission. Good find.]
  Post a comment  •  Comments (2)  
  • Currently 4.00 / 5
  You rated: 4 / 5 (3 votes cast)
 
[390 views] Email Article To a Friend View Printable Version
Logitech Solar Keyboard and the Scroll Lock/Num Lock keys Other Hardware
I'm a happy user of the Logitech Solar Keyboard for Mac -- never having to change batteries is quite liberating. However, this keyboard lacks a few things, including dedicated Scroll Lock and Num Lock keys, that you may find on other keyboards.

I don't use those two keys often, but I do use them while working in Excel. After some trial and error, and some Googling, I figured out how to turn them on and off. (Because there aren't any physical keys, there aren't any indicator lights for these keys' states. Instead, you have to look at Excel's onscreen indicators, at the lower right corner of the worksheet.)

Scroll Lock: Press Shift+F14.
Num Lock: Press Shift+Clear (on the numeric keypad).

I'm not sure if these shortcuts work on other Logitech keyboards or not.

[crarko adds: The hassle of dealing with batteries has kept me away from wireless keyboards all along; this may just change my mind.]
  Post a comment  •  Comments (1)  
  • Currently 5.00 / 5
  You rated: 5 / 5 (2 votes cast)
 
[616 views] Email Article To a Friend View Printable Version
Sticky Widget from Selected Text Apps
There's a recent Macworld article for quickly making Stickies. I thought that some folks might want to make Sticky Widgets instead.

This is derived from my hint posted a few years ago.

Depending on your system version (and possibly other factors), you may need to launch Dashboard at least once if you haven't since system startup before trying the Service.

Here are the simple steps:
  • Open Automator and create an empty Mac OS X Service document. In the document window set the first popup to text and the second pop-up to any application.
  • Drag a Run AppleScript action into the right side of the Automator document window. Then paste the following line into the Run AppleScript step just beneath the (* Your script goes here *) line:
        activate
        set inputText to (input as text)  
        do shell script "open /Library/Widgets/Stickies.wdgt"
        delay 0.2
        tell application "System Events"
          keystroke tab
          keystroke tab
          keystroke inputText
        end tell
      
  • Save the Service document as 'Sticky Widget from selected text,' then open the Keyboard prefpane.
  • In the Keyboard Shortcuts segment tab, click Services, and put Command+Ctrl+Shift+S into the shortcut area for the Sticky Widget from selected text entry in the list. Close the prefpane (the keyboard trigger is just a suggestion - you can use others, just be sure to test, because whether a shortcut works or not can be affected by lots of things).

[crarko adds: I tested this (without the shortcut), and it works as described.]
  Post a comment  •  Comments (2)  
  • Currently 1.00 / 5
  You rated: 1 / 5 (1 vote cast)
 
[498 views] Email Article To a Friend View Printable Version
10.7: Unlock screens using any admin password Apps
Under Lion, the screen saver authentication dialog box does not allow you to enter a username. So even if you've made the changes detailed in this Snow Leopard hint there is no way to put in alternate credentials to unlock a user's screen.

First, edit /etc/pam.d/screensaver as per the original Snow Leopard hint:
  • Open /Applications/Utilities/Terminal.app
  • Type cd /etc/pam.d
  • 3. sudo cp screensaver screensaver.bak
  • 4. sudo nano screensaver
  • 5. Find the line:
    account required pam_group.so no_warn group=admin,wheel fail_safe
    and change it to:
    account sufficient pam_group.so no_warn group=admin,wheel fail_safe
  • Press Control+X to save /etc/pam.d/screensaver and exit nano.
Then, still in Terminal, we make a wholly unintuitive change to /etc/authorization:
  • cd /etc
  • sudo cp authorization authorization.bak
  • sudo nano authorization
  • Press Control+W and search for unlock the screensaver
  • Change the line:
    <string>The owner or any administrator can unlock the screensaver.</string>
    to:
    <string> (Use SecurityAgent.) The owner or any administrator can unlock the screensaver.</string>
  • Press Control+X to save /etc/authorization and exit nano.
  • Reboot the Mac

[crarko adds: I haven't tested this one, but the original Snow Leopard hint was good. Be sure to make the file backups before doing any editing, and if it were me, I'd want to do this on a test machine (with a full system backup) before deploying it. If you try this and find any errors/omissions please post them in the comments, and I'll correct the hint.

Note: Changed references to /etc/authentication to the correct file /etc/authorization and other cleanup.]
  Post a comment  •  Comments (11)  
  • Currently 5.00 / 5
  You rated: 5 / 5 (2 votes cast)
 
[777 views] Email Article To a Friend View Printable Version
iOS 5: Automatic Recognition of UPS Tracking Code in Mail iOS devices
As you know, there are plenty of tools to keep track of shipments that are shipped with UPS. There is an app called Delivery Status which even recognizes an UPS shipment by just copy and pasting the tracking number into the app.

I just noticed that iOS seems to recognize the shipment all by itself.

In iOS Mail (iOS 5.0.1) every number is highlighted to be called as a possible phone number. But in this case the number was my UPS tracking code. Upon tapping the number I got the options to either copy it or track it.

By tapping tracking it opens an ups site with the tracking number already applied to the script so that you can see the status of your shipment. Ergo no need to copy and paste an UPS tracking code to any other program or the UPS site itself.

[crarko adds: I tested this, and it works as described. As mentioned in this previous hint this was a new feature in Mail with Lion. This hint confirms it for iOS 5 Mail as well.]
  Post a comment  •  Comments (3)  
  • Currently 3.00 / 5
  You rated: 1 / 5 (4 votes cast)
 
[681 views] Email Article To a Friend View Printable Version
10.7: Setting duration before files are locked System 10.7
As you know, Lion locks files that have not been changed for 2 weeks, so that you have to unlock them before editing them.

There is a control to change the length of time before a file is 'locked' by Lion.

In System Preferences » Time Machine » Options, there is a control to set the length of time after the last edit before files are locked.

The options are 1 day, 1 week, 2 weeks (default), 1 month, 1 year.

I presume that there's a corresponding plist setting that you can 'defaults write' to values not in the dropdown list.

[crarko adds: This is one of those things that's obvious once you know about it, but probably wouldn't think to look for it under Time Machine preferences if you didn't.]
  Post a comment  •  Comments (5)  
  • Currently 4.86 / 5
  You rated: 5 / 5 (7 votes cast)
 
[996 views] Email Article To a Friend View Printable Version
iOS Device Screenshots & iPhoto Smart Albums iOS devices
If you're looking for an easy way to sort your iOS device screenshots in iPhoto, here's a few handy smart album configurations that may help.

For documentation at work I take numerous screenshots of the different iOS apps we use.

In an attempt to organize these screenshots easily in iPhoto, I came across these two Smart Album configurations that might be helpful to others.

For iPad match all of the following conditions:
  • Aperture is Unknown
  • ISO is Unknown
  • Filename starts with IMG_
  • Filename contains PNG
  • Any Text contains 1024
The last step filters out the iPad screenshots from other iOS device screenshots (iPhone, iPod Touch).

For iPhone (or iPod Touch) match all of the following conditions:
  • Aperture is Unknown
  • ISO is Unknown
  • Filename starts with IMG_
  • Filename contains PNG
  • Any Text contains 960 (or 480 if it's a non-retina display)

[crarko adds: This seems to work as described with my 1st-gen iPad and iPhoto 9.2.1.]
  Post a comment  •  Comments (1)  
  • Currently 4.50 / 5
  You rated: 4 / 5 (2 votes cast)
 
[835 views] Email Article To a Friend View Printable Version