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

"Portable" TextWrangler with Dropbox Apps
I love TextWrangler, and I have a Mac at work and one at home, but often do coding on both. I set up a system using Dropbox so both my preferences and my Application Support files sync so I always have my stationery files and the same settings, wherever I am.

Run the following as a shell script on each of the Macs. This will copy TextWrangler to your Dropbox folder, and create the support folder on Dropbox, then create a symlink to it in the correct location on your Macs. It will then copy the preference files to Dropbox, so when you launch the application on either Mac, you'll have the same setup.
#!/bin/bash
#+ Portable TextWrangler

#* Formatted date & time string.
FORMATTED_DATE=`/bin/date "+%Y-%m-%d%H%M%S"`

#+ Remove it from /Applications (optional, just so you can replace it with a ln to your dropbox)
sudo /bin/mv -f /Applications/TextWrangler.app ~/.Trash/

#* Add a link in /Applications to your DropBox copy
sudo /bin/ln -Fs ~/DropBox/TextWrangler.app /Applications/TextWrangler.app

#* Archive existing folder
/bin/mv -f ~/Library/Application Support/TextWrangler{,.$FORMATTED_DATE}

#+ Create cloud app support folder
/bin/mkdir -p ~/DropBox/TextWrangler

#+ Link cloud app support folder to your local workstation (this contains your stationery, etc.)
sudo /bin/ln -Fs ~/DropBox/TextWrangler ~/Library/Application Support/TextWrangler

#+ Create cloud app support folder for your preferences
/bin/mkdir -p ~/DropBox/TextWrangler/Preferences

#* Placeholder so your prefs go to the cloud
/usr/bin/defaults write ~/DropBox/TextWrangler/Preferences/com.barebones.textwrangler Placeholder true

#* Link cloud pref to your local workstation
sudo /bin/ln -Fs ~/DropBox/TextWrangler/Preferences/com.barebones.textwrangler.plist ~/Library/Preferences/com.barebones.textwrangler.plist

exit 0
[kirkmc adds: Personally, I wouldn't do it this way. For example, I don't see why you would copy the application itself to Dropbox; you can just have a copy on each Mac. You also might not want to have the preferences the same on both Macs, if one is a desktop and the other a laptop. So all that leaves is the support folder, which is easy to symlink.

If you want to do this with BBEdit, it's much simpler. As explained on the Bare Bones web site, BBEdit will look for the support folder on your Dropbox folder.]
  Post a comment  •  Comments (4)  
  • Currently 2.00 / 5
  You rated: 1 / 5 (6 votes cast)
 
[5,203 views] Email Article To a Friend View Printable Version
Two AppleScripts for unmounting, mounting local disk volumes Apps
These AppleScripts are related to this hint. Both can already be found in the replies to the hint topic post, but I'm resubmitting them so that they will appear together.

The first is an improved version of the original AppleScript which presents a dialog box from which a selection of local volumes to be ejected can be made. An example of its usefulness might be that it provides a reliable method for quickly ejecting a MacBook's mounted local volumes for users on the go. I've configured it as a "Run AppleScript" step for an Automator-based Mac OS X Service called "Unmounter" and assigned it the keyboard shortcut of (Command-Control-Shift-E) in System Preferences on my system.

The second is a more robust version of the AppleScript included in my first reply to the original hint topic. It attempts to automatically unmount all unmountable local volumes, and if it finds none, attempts to mount any local volumes that are available. I've configured it as a "Run AppleScript" step for an Automator-based Mac OS X Service called "Toggle Available Local Volumes" and assigned it the keyboard shortcut (Command-Option-Control-Shift-E) in System Preferences on my system.

For both Automator-based Mac OS X Services that I created to provide key triggers for the AppleScripts, the scope specified is "Service receives no input in any application."
set alldisks to paragraphs of (do shell script "df -hlg | awk -F/ '/disk*/ {print $5}'")
set nonbootnumber to (count of alldisks)
try
   set alldisks to items 2 thru nonbootnumber of alldisks
   activate
   set your_selected_device_id to choose from list alldisks with prompt "Please choose one or more volumes to be unmounted." with multiple selections allowed
   repeat with the_Item in your_selected_device_id
       set the_ID to (do shell script "df -hlg | grep -m 1" & space & quoted form of the_Item & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
        try
           do shell script "diskutil unmount /dev/" & the_ID
       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 error the error_message number the error_number
   if the error_number is -128 or the error_number is -1708 then
   else
       display dialog "There are no unmountable volumes." buttons {"OK"} default button 1
   end if
end try


set alldisks to paragraphs of (do shell script "df -hlg | awk -F/ '/disk*/ {print $5}'")
set nonbootnumber to (count of alldisks)

try
   set all_non_boot_disks to items 2 thru nonbootnumber of alldisks
on error
   set all_non_boot_disks to {}
end try
if (count of all_non_boot_disks) > 0 then
   try
       activate
       repeat with the_Item in all_non_boot_disks
           set the_ID to (do shell script "df -hlg | grep -m 1" & space & quoted form of the_Item & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
            try
               do shell script "diskutil unmount /dev/" & the_ID
           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 error the error_message number the error_number
       if the error_number is -128 or the error_number is -1708 then
       else
           display dialog "There are no unmountable volumes." buttons {"OK"} default button 1
       end if
   end try
else
   set actiondisks to {}
    set allvols to paragraphs of (do shell script "diskutil list -plist | grep -o 'disk[0-9][a-z][0-9]*'")
    repeat with i in allvols
       if i is not in actiondisks then
           set actiondisks to actiondisks & i
       end if
   end repeat
   repeat with myitem in actiondisks
       try
           do shell script "diskutil mountDisk /dev/" & myitem
       end try
   end repeat
end if
[kirkmc adds: I'm posting this so the final scripts can be easier to find. There were a lot of comments that helped the poster improve on his original submission, and I thank all the users who gave their thoughts on the original script, and the poster who took the time to improve it and re-post it.]
  Post a comment  •  Comments (13)  
  • Currently 2.00 / 5
  You rated: 4 / 5 (4 votes cast)
 
[9,312 views] Email Article To a Friend View Printable Version
Copy partially played Audiobooks to a playlist Apps
iTunes Smart Playlists don't offer a criteria to find tracks which have been partially played. While "Last Skipped" is an option, this track property may not be set if the track wasn't actually skipped and was merely stopped.

However, if a track's "Remember playback position" option is set (and most audiobooks have this set by default) the track's AppleScript bookmark property will contain the number of seconds that a track has advanced before being stopped. Thus, any track with a bookmark value greater than zero would have been partially played.

Here is an AppleScript that will copy all the tracks in the "Books" library to a new playlist named "Partially Played". Each time it is run it will update the "Partially Played" playlist.
read more (83 words)   Post a comment  •  Comments (0)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[3,293 views] Email Article To a Friend View Printable Version
Drag files from Safari 5 Downloads popup Apps
I recently tried to drag from Safari's Downloads popup and found that if you drag from the icon of the downloaded file, you can move it where you want.

Click on an icon in the Downloads popup and drag it to any folder, or even onto a Dock icon to launch a file you've just downloaded with a specific application.

[kirkmc adds: This seems obvious, but there's no hint here for it. There have been hints about double-clicking an icon in the Downloads window to open it, copying and pasting URLs from the Downloads window, and the keyboard shortcut to show the Downloads popup (Command-Option-L).]
  Post a comment  •  Comments (2)  
  • Currently 3.83 / 5
  You rated: 2 / 5 (6 votes cast)
 
[4,290 views] Email Article To a Friend View Printable Version
Remove rubber band scrolling in most apps Apps
Combining some findings from a recent hint and on Apple's forums, I've finally found a way to disable the annoying rubber-band scrolling in most applications. All the credit goes to those guys as they did the initial investigation.

It works in applications like:
  • Finder
  • Mail
  • Preview
  • TextEdit
  • Xcode
and probably in most applications that use the standard UI (the string to be used in defaults appears in AppKit.framework). It doesn't work in Safari or iTunes.

In Terminal type:
defaults write -g NSScrollViewRubberbanding -int 0
It should work after you relaunch your applications.

To undo this change, run this command in Terminal:
defaults delete -g NSScrollViewRubberbanding
[kirkmc adds: Works as described. I haven't tested many apps, so feel free to post which ones work and which don't in the comments.]
  Post a comment  •  Comments (18)  
  • Currently 4.13 / 5
  You rated: 4 / 5 (8 votes cast)
 
[9,569 views] Email Article To a Friend View Printable Version
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.11 / 5
  You rated: 1 / 5 (9 votes cast)
 
[5,568 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 3.88 / 5
  You rated: 1 / 5 (8 votes cast)
 
[3,685 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.23 / 5
  You rated: 2 / 5 (13 votes cast)
 
[35,324 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.20 / 5
  You rated: 2 / 5 (5 votes cast)
 
[3,764 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)
 
[13,597 views] Email Article To a Friend View Printable Version