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

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.20 / 5
  You rated: 2 / 5 (5 votes cast)
 
[3,791 views] Email Article To a Friend View Printable Version
Fix some iChat connection problems Apps
There are days when I cannot connect to iChat's servers - well, actually to the AIM servers that iChat uses. The fix is simple yet odd. I use SSL with iChat, and all it takes to get the connection is to turn it off. Go to iChat > Preferences > Accounts, click on your account, then click on the Server Settings tab. You must be offline to make changes here. If you have Use SSL checked, uncheck it, then connect. Disconnect, then reconnect it, if you still want to use SSL. I don't know why this works, but it does.
  Post a comment  •  Comments (2)  
  • Currently 4.00 / 5
  You rated: 4 / 5 (5 votes cast)
 
[14,169 views] Email Article To a Friend View Printable Version
Convert multiple text files to Mail notes Apps
I have been using plain text files (.txt) for storing my notes since the arrival of Notational Velocity a while ago. When I saw that Mountain Lion will have a dedicated Notes app, I decided it would be great to switch over to Mail's notes system in preparation for the new OS.

I couldn't find a suitable method for rapidly importing my text notes into apple mail, so I combined a script found on MacRumors with some python, which can then be packaged into a Service using Automator ("Service receives selected files and folders").
import sys
import os
print sys.argv
for filename in sys.argv[1:]:
    print filename
    text = open(filename,'r').readlines()
    title = os.path.splitext(os.path.basename(filename))[0]
    text = title +'\n'+' '.join(text)

    # Store file contents in clipboard
    outf = os.popen("pbcopy", "w")
    outf.write(text)
    outf.close()

    cmd = """osascript< < END
	tell application "Mail"
		activate
	end tell

	tell application "System Events"
		tell process "Mail"
			click the menu item "New Note" of the menu "File" of menu bar 1
			click the menu item "Paste" of the menu "Edit" of menu bar 1
		end tell
	end tell
    END"""

    os.system(cmd)
[kirkmc adds: I haven't tested this. But I do agree that it will be practical to use Apple's Notes app on Mountain Lion. However, I'm not prepared to use Mail for notes; I don't like the display options.]
  Post a comment  •  Comments (4)  
  • Currently 3.20 / 5
  You rated: 3 / 5 (5 votes cast)
 
[5,780 views] Email Article To a Friend View Printable Version
Make Mail badge report only personal emails Apps
The Mail application can report the number of unread e-mails via a badge on the application’s Dock icon. It would be more useful if the badge showed more relevant personal e-mails (sent to you personally and not to a mailing list, ord sent from somebody you know). This way the user is interrupted less often, while still keeping track of relevant emails. Recently, Gmail has offered a way to prioritize emails (Gmail > Settings > Personal level indicators). The good news is that a similar technique can be used in Mail.

To have the personal emails reported, first create a “Personal email” rule. To create a rule in Mail, choose Mail > Preferences > Rules, then click on "Add rule." Name the rule “Personal email” and select the following:
  • The rule should match any of the following conditions
  • "Sender is in my Previous Recipients"
  • "Sender is in my Address Book"
  • "Perform action": flag emails with a gray flag
Next, create a smart mailbox called “Relevant emails” that communicates with the rule defined above by looking at flagged emails. You can create a smart mailbox by choosing Mailbox > New Smart Mailbox. Specify that e-mails in the smart mailbox should satisfy all of the following conditions:
  • E-mail should be unread ("Message is unread")
  • Flagged ("Message is flagged")
  • In your inbox ("Message is in Mailbox Inbox")
  • Has been sent directly to you ("Any recipient contains myemail@mydomain").
Finally, go to Mail's General preferences, and next to “Dock unread count” choose the “Relevant emails” smart mailbox.

The dock badge will now count unread personal e-mails from the smart mailbox you just created.

[kirkmc adds: I have actually done something similar for years. I have a "Current" smart mailbox, which contains messages that are important; everything but mailing lists, Google alerts and spam. That is the one I have selected for the Mail icon badge.

We ran a hint about this in 2009, but it simply specified how to choose a smart mailbox for the badge count. This current hint is useful as it explains how to filter specific e-mails that come from people you know.]
  Post a comment  •  Comments (4)  
  • Currently 3.29 / 5
  You rated: 1 / 5 (7 votes cast)
 
[10,124 views] Email Article To a Friend View Printable Version
Long list of defaults commands Apps
If you've been around this site for a while, you know that the "defaults" command in Terminal can do a lot. It can set many hidden settings and preferences in Mac OS X, and in individual applications.

Mathias Bynens has posted a long list of these commands on github. I haven't looked closely, but I'm willing to bet that some of them haven't been posted here as hints yet.

There used to be a great tool called Secrets, which was a preference pane, and which allowed GUI access to many of these commands. Alas, Secrets hasn't been updated for Lion, so using Terminal is the best way to apply these commands.

If you're unfamiliar with how to use these commands, here's what you need to know. Open Terminal (in /Applications/Utilities), then paste one of the commands into Terminal and press Return. The commands in the list are the parts that begin with "defaults," such as:
defaults write com.apple.dock no-glass -bool true
This command removes the 3D graphics from the Dock.

Thanks to appstorm Mac for pointing out this page.
  Post a comment  •  Comments (11)  
  • Currently 4.50 / 5
  You rated: 5 / 5 (8 votes cast)
 
[18,711 views] Email Article To a Friend View Printable Version
10.7: Disable folder drop-down in Terminal menu bar Apps
In 10.7, Apple changed Terminal to include a drop-down path icon in the window's title bar, similar to what you get in Finder and many other applications.

While some may like this, the problem is that it actually changes the window's title, as seen by applications (such as our own window manager, Moom). For instance, run this command in 10.7's Terminal...

osascript -e "tell application \"Terminal"\ to return name of window 1"

...and you'll see the current folder reflected in the window title. If you'd rather not have the path there, the fix is simple. Just add this command to your .profile file (or whatever file you use to init your Terminal windows):

unset PROMPT_COMMAND

Save the .profile file, close and open a new Terminal window, and you'll see that the folder drop-down has vanished from the window title.
  Post a comment  •  Comments (1)  
  • Currently 4.40 / 5
  You rated: 3 / 5 (5 votes cast)
 
[4,031 views] Email Article To a Friend View Printable Version
Organize videos by group in iTunes Apps
In iTunes, there are two ways to categorize your videos: as either Movies or TV Shows. I use the Movies category for very large files, and put everything else in TV Shows, because in the TV Shows library, iTunes allows you to create groups. I've created groups called You Tube Videos, Home Videos, Work Stuff, etc.

To create a group, first make sure both TV Shows and Movies are visible in the iTunes source list. If they're not, go to iTunes' General preferences and check Movies and TV Shows in the Show section.

Next, import your new movie into iTunes by dragging it to the source list where these libraries display. In most cases, iTunes will categorize it as a movie. Select the movie and press Command-I to display the Info window. Click on the Options tab, then, under Media Kind, choose TV Show. If it's as short video, you might want to uncheck Remember Playback Position, because you will most likely always want to start these types of files from the beginning.

Next, click on the Sorting tab. Correct the tag that iTunes applied, if necessary, in the Name field. To create a nested group, you must enter some text in the Show field. You'll want to apply the same name for every item in the group, so the files stay in that group. Click on OK, and this will be applied.

When you look at your TV Shows library now, you'll see that all members of a group will display, in Icon or Cover Flow view, behind a single icon. In Album List view, all of the videos will display, but you'll see them sorted by "Show," or the group name you gave them.

[kirkmc adds: This is a good workraound that can help you organize a big video library, though there are some problems. iTunes seems to choose arbitrarily which icon to display when in icon view, rather than, say, the first item.

Another way you could do this, if you want to display the items in Icon view, is to choose to display them by Genre, and apply custom genres to your video files. However, using the Show tag allows this organization to also display on an Apple TV.]
  Post a comment  •  Comments (2)  
  • Currently 3.17 / 5
  You rated: 4 / 5 (6 votes cast)
 
[23,750 views] Email Article To a Friend View Printable Version
Export PDF to Dropbox directly from iOS device Apps
My workflow often involves taking Word Documents and manipulating them with handwritten annotations on my iPad. With this method, I can immediately take a downloaded .docx (or presumably any other MS Office file), convert it to a PDF, get it into my Dropbox, and finally my annotation app; all without leaving the iPad. While it may seem clumsy at first, it only takes four easy steps.

You will need the Pages app, the Dropbox app, a Dropbox account, and a a send to dropbox account.
1. Import your document into the Pages app.
2. Tap the wrench and select "Share and print."
3. Email a PDF to your @sendtodropbox address.
4. Check out the "Attachments" folder in Dropbox (or your desired Dropbox-linked 3rd party app).

[kirkmc adds: I haven't tested this.]
  Post a comment  •  Comments (5)  
  • Currently 4.33 / 5
  You rated: 5 / 5 (6 votes cast)
 
[20,865 views] Email Article To a Friend View Printable Version
Decompress zip archives that expand to .cpgz archives Apps
I'd come across this before, and it was very annoying. Last night, I downloaded a zip archive of freely-distributed MP3 files, and when I double-clicked it to decompress it, all I got was a .cpgz file. This is apparently a zipped CPIO archive file. Double-clicking that file just created the zip file again, and this was an endless loop

Searching on Google, I saw that plenty of people had come across this problem, and offered a number of suggestions, none of which worked for me. Some articles suggested that the download might have been corrupted, but as this was a very large file, I didn't want to try and download it again.

The solution for me was to use the free The Unarchiver, which has turned out to be a Swiss army knife for decompressing many obscure types of archives. Opening the file with The Unarchiver decompressed it correctly.

I didn't think of it at the time - and I have since deleted the archive - but the cpio command would probably have worked via Terminal as well. In any case, if you encounter this odd archive decompression loop, here's an easy way to solve the problem
  Post a comment  •  Comments (3)  
  • Currently 3.75 / 5
  You rated: 1 / 5 (8 votes cast)
 
[67,719 views] Email Article To a Friend View Printable Version
Delete Mail messages with Control-H keyboard shortcut Apps
The other day on Twitter, Macworld senior editor Dan Frakes mentioned that he had accidentally discovered an undocumented keyboard shortcut to delete messages in Mail. My guess is that he just leaned on his keyboard, but he figured out, after deleting a number of messages, that this shortcut is Control-H.

This makes sense, as this is the Unix keybinding for the Backspace or Delete key (see this Wikipedia article), and OS X uses these shortcuts, at least in Cocoa applications; you can use the Control-H shortcut to delete text in those applications that use the Cocoa text input framework. But its use to delete messages in Mail is interesting. If anyone discovers other apps where this works, post them in the comments.
  Post a comment  •  Comments (7)  
  • Currently 2.80 / 5
  You rated: 5 / 5 (5 votes cast)
 
[8,444 views] Email Article To a Friend View Printable Version