Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Remove scrolling elasticity in Xcode Apps
Mac OS X Lion introduced iOS-style scrolling elasticity. Do you think it's annoying, and it slows you down while working in Xcode? Here's how to remove it.

Copy this Xcode plugin to the following directory:

~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/

You should create the directories if needed.

Enjoy!
  Post a comment  •  Comments (9)  
  • Currently 3.25 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[4,250 views] Email Article To a Friend View Printable Version
Scroll PDF in Finder in Column View System 10.7
In the Finder, when working in Column View, if you select a multipage PDF you can scroll up and down in the document. This is much faster than using the small arrow controls, and appears to work with any input device that can scroll.

[kirkmc adds: Several points. First, in Column View, you need to have Show Preview Column checked in the View settings. When you select a PDF, its first page shows in the Preview column. From there, you hover your cursor and see two arrow buttons. You can either click on these or scroll.

This might be useful if you just need a quick glance at a file, but once you've selected the PDF, you can view it in Quick Look by pressing the space bar, which lets you see the document at full size.]
  Post a comment  •  Comments (6)  
  • Currently 3.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[3,877 views] Email Article To a Friend View Printable Version
Moving custom paper sizes from Snow Leopard to Lion System 10.7

I was recently asked to see if I could copy over the custom page sizes from a Snow Leopard machine over to a Lion machine.

While finding the right file in ~/Library/Preferences (com.apple.print.custompapers.plist) wasn't so difficult, it turned out that the Snow Leopard version of the file is binary encoded while the Lion version is not. (It may be that this file was grandfathered in from a previous system.)

XCode for Lion can convert the file to a regular XML text file:

  1. Open the file in Xcode.
  2. Choose File > Duplicate.
  3. In the Save dialog box, select "Property List XML" from the Format drop-down list.

Moving the regular text version over to Lion and putting it into the Preferences folder gave us a way to copy a huge list of custom paper sizes from one designer to another quickly and easily.

  Post a comment  •  Comments (5)  
  • Currently 4.25 / 5
  You rated: 3 / 5 (4 votes cast)
 
[4,090 views] Email Article To a Friend View Printable Version
AppleScript for selecting local volumes to unmount System
Note: An updated version of this script (in fact two new scripts) has been posted as a new hint. These new scripts take into account many of the comments posted below. Please see the new hint to find the improved version.

Here's an AppleScript that presents a dialog box listing mounted local volumes, one or more of which can be selected for unmounting. Some solutions for doing this either require the use of additional system resources or are offered commercially. This AppleScript is free, of course. I’ve only tested it in Lion so far. I recommend that you set up a keyboard shortcut that launches the AppleScript either as part of a Mac OS X Automator Service, or from the Script menu, which (in Lion) can be configured using the Keyboard preferences.
set alldisks to paragraphs of (do shell script "df -hlg | awk -F/ '/disk*/ {print $5}'")
try
   set item 1 of alldisks to ((characters 1 thru -2 of (path to startup disk as string)) as text)
on error
   set alldisks to {((characters 1 thru -2 of (path to startup disk as string)) as text)}
end try

set dur to {}
repeat with m in alldisks
   considering case
       if m is not in {"MobileBackups"} then
           set dur to dur & m
       end if
   end considering
end repeat

set devnames to paragraphs of (do shell script "df -k | awk -F/ '/disk*/ {print $3}'")
set t to {}
repeat with s in devnames
   set t to t & (word 1 of s)
end repeat

set the keylist to dur
set the foundDisks to t
set answer_list to {}

repeat with the_answer in keylist
   set theIndex to my CollectUniqueItemIndex(keylist, (the_answer as string))
    set theValue to item theIndex of foundDisks
   activate
   --set answer_list to answer_list & return & ((the_answer & ":" & space & theValue) as string)
   --set answer_list to answer_list & ((the_answer & ":" & space & theValue) as string)
   set answer_list to answer_list & (the_answer as string)
end repeat


set your_selected_device_id to choose from list answer_list with prompt "Please choose one or more volumes to be unmounted." with multiple selections allowed
repeat with b in your_selected_device_id
   set theIndex to my CollectUniqueItemIndex(answer_list, (b as string))
    set theValue to item theIndex of foundDisks
   --display dialog "The device name of a volume you selected is:" & space & "\"" & theValue & "\"." & space & "Are you sure you want to unmount it?"
   try
       do shell script "diskutil unmount /dev/" & theValue
   on error the error_message number the error_number
       display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
    end try
   
end repeat

on CollectUniqueItemIndex(theList, theItem) -- the Item can be string, number, constant, app object or list    
   local aListMember
   repeat with i from 1 to (count theList)
        set aListMember to item i of theList
       if aListMember = theItem then
           set theIndex to i
           exit repeat
       end if
   end repeat
   return theIndex
end CollectUniqueItemIndex

[kirkmc adds: This is a very nice script, works as advertised.]
  Post a comment  •  Comments (24)  
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[5,963 views] Email Article To a Friend View Printable Version
Option-up arrow and Option-down arrow cycle through sent messages in iChat Apps
When focus is in the text entry field in an iChat chat window, holding option and using your up and down arrow keys cycles through the previous messages you've sent. This is very similar to how Terminal lets you cycle through previous command just using the up and down arrow keys.

[kirkmc adds: I actually spotted this a while ago. I'm not sure why it's there; and I don't really see any use for it, other than, perhaps, to find a text you sent to someone without scrolling in the window, and then copy it to send to someone else. This works in Lion; can anyone confirm that whether works in earlier versions of OS X or not?]
  Post a comment  •  Comments (4)  
  • Currently 4.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[3,054 views] Email Article To a Friend View Printable Version
Build a service to count characters, words and paragraphs System 10.6
Apple does not provide any way to count the number of characters in a selected text. Fortunately, you can create your own very easily using Automator.

Launch Automator and create a new Service. Add the Run AppleScript script action, then paste the following code:
on run {input, parameters}
	try
		set MyText to input as string
		set NombreSignes to the number of characters of MyText
		set NombreMots to the number of words of MyText
		set NombrePara to the number of paragraphs of MyText
		set LeResultat to "The selected text contains :" & return & "- " & NombreSignes & " sign(s) ;" & return & "- " & NombreMots & " word(s) ;" & return & "- " & NombrePara & " paragraph(s)."
		display dialog LeResultat buttons {"OK"} default button 1 with icon note
	on error errmsg number errnum
		display dialog errmsg & " [" & errnum & "]" buttons {"OK"} default button 1 with icon stop
		
	end try
	return input
end run
Now save the service and use a name such as "Count characters in selection."

To use the service, select any text in a text application (this does not work in Word, however), then choose your service in the contextual menu.

You can download a precompiled service here. This has been tested successfully on Mac OS X 10.6 and 10.7.

[kirkmc adds: This works as advertised. For some reason, however, when I install the precompiled service, while its name is "Count characters in selection," it displays in the Services menu as "Compteur de signes," which is French for character counter. If you're unfamiliar with using services in OS X, you can see this Macworld article I wrote earlier this year.

We ran a hint using AppleScript to count words and characters back in 2007, which uses a different approach, requiring that you copy text to the clipboard.]
  Post a comment  •  Comments (18)  
  • Currently 3.48 / 5
  You rated: 5 / 5 (33 votes cast)
 
[6,887 views] Email Article To a Friend View Printable Version
Use Logitech N305 number pad with Mac Other Hardware
My right shoulder had been hurting lately, due to the movement necessary to reach my trackpad. I was using a standard, wired Apple keyboard with the number pad on the right, and my Magic Trackpad was to the right of that, making me reach pretty far to access it.

So, I set out in search of a standalone number pad I could use with my Mac. While I don't work with numbers often, when I do my accounting, it's a pain to have to type numbers from the top row of the keyboard. I looked at a number of models - both wired and wireless - and found what seemed to be the best choice: Logitech's N305. This works with Logitech's Unifying Receiver, is fairly compact, and, according to Logitech, works for three years with a pair of batteries.

But the N305 does not support Macs. Fortunately, in reviews for the product on Amazon, a number of people posted a solution. Download the free KeyRemap4MacBook, a preference pane that lets you remap just about any key on your keyboard or number pad. There is a specific setting in this preference pane for the N305: in the Change KeyPad Key section, you check Logitech N305 hack. The number pad works perfectly, though the top three buttons, which have specific Windows functions (one launches Excel, another the calculator, and a third switches applications).
  Post a comment  •  Comments (3)  
  • Currently 3.80 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[7,303 views] Email Article To a Friend View Printable Version
Reduce the size of Google Chrome Apps
]Google Chrome keeps older versions of its web browser causing it to balloon in size. I noticed that the Google Chrome App on my Mac was 1.2 GB. That seemed a bit portly for a web browser. Upon looking into the app's bundle, by right-clicking and choosing Show Package Contents, I found multiple old versions of the app, all which appeared to be nearly identical. I removed all but the most recent version and everything appears to run correctly and the app size is now a much more slim 113 MB.

[kirkmc adds: Interesting. On my Mac, in the bundle, in Contents > Versions, there are, indeed, two versions of Chrome. This presumably has something to do with Chrome's silent updating. (Queries on Twitter suggest that this is the norm; a number of people replied that theirs was around 220 MB, as was mine.) Make sure you keep the one with the highest version number. You could also, of course, just download a new copy.

If you want to turn off this automatic updating, see this hint from 2010.]
  Post a comment  •  Comments (10)  
  • Currently 4.36 / 5
  You rated: 5 / 5 (11 votes cast)
 
[14,863 views] Email Article To a Friend View Printable Version
Get rid of intermittent SSH_AUTH_SOCKET environment variable from SSHKeychain Apps
SSHKeychain used to set the SSH_AUTH_SOCK environment variable to something like /tmp/50x/SSHKeychain.socket, but even getting rid of SSHKeychain didn't get rid of the environment setting.

I used to use a great little program called SSHKeychain to maintain my ssh world on OS X. Even after Apple's keychain started dealing with ssh-agent properly, I still kept SSHKeychain around for the convenience of maintaining my ssh tunnel configurations in one place.

However, there was an occasional mismatch between the SSHKeychain way of doing things and the Apple keychain way, and SSHKeychain seemed to have fallen into disrepair, with no maintenance (on SourceForge at least) since 2007.

A few months back, I finally got rid of SSHKeychain, and started having problems.

There was apparently a phase-of-the-moon dependent race condition (somewhere) that clobbered the Apple keychain setting of SSH_AUTH_SOCK with a setting left over from SSHKeychain. This manifested itself as an occasional (during about 50% of my logins to my OS X account) demand for me to enter my ssh passphrase every time I made an ssh connection somewhere else. This, of course, kind of defeats the whole purpose of using ssh-agent in the first place, and was a major pain as well.

I looked at everything I could think of (e.g. .profile et al.) that was related to the problem to no avail. Spotlight was no help in locating the where the variable was being set from. Finally, yesterday, I decided that enough was enough, and ran a find|grep chain over what I thought was my entire disk. There were a few hits (including one in /private/var/vm/sleepimage that seemed like it could have been causing the problem) but getting rid of those still didn't do the trick.

I finally stumbled upon a useful magic search phrase for the problem in Google, and found this discussion from 2007.

It turns out that the culprit was the file ~/.macosx/environment.plist which appears to only have set that one environment variable. Getting rid of that file got rid of the intermittent clobbering of the SSH_AUTH_SOCK variable, and allowed the Apple keychain to maintain access to ssh-agent in the modern fashion.

Woot.

As an aside, I apparently did not construct my find command (in the find|grep chain that I mentioned above) in a way that allowed it to descend into directories starting with a '.' and my brute force search missed the culprit.

I hope this helps someone else avoid all of the blood, sweat, and tears I expended on the problem.

[kirkmc adds: As obscure as this is, we all know what it's like to search for an uncommon problem and not find it. Every problem of this type that is documented helps others in the future when they search for a response.

It's worth noting that we had a hint about some problems with SSHKeychain back in 2007 as well.]
  Post a comment  •  Comments (3)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[3,304 views] Email Article To a Friend View Printable Version
New poll: Which is your favorite Mac? Site News
It's time for a new poll. Following Apple's quarterly earnings call, where the company announced selling 4 million Macs in the last quarter (see Macworld's discussion of Apple's earnings), this could be a good time to find out which model Mac OS X Hints readers prefer. Will it turn out that laptops are popular with readers of this site? They represent 70% of Apple's sales. Or is the Mac Pro still a favorite?

You can vote in the poll, and feel free to post comments on that page about why you selected a specific model.
  Post a comment  •  Comments (24)  
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[3,891 views] Email Article To a Friend View Printable Version