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 (2)  
  • Currently 1.00 / 5
  You rated: 1 / 5 (1 vote cast)
 
[237 views] Email Article To a Friend View Printable Version
Permanently Unhide Library System 10.7
When Apple shipped Mac OS X Lion 10.7, the “Library” folder located within every user’s home folder, which had previously been visible to users in the Finder, was made invisible. This hint shows how to make the folder visible and keep it that way forever.

As you may know, and as mentioned in this hint, the Library folder can be made visible again by running the following command in Terminal:

/usr/bin/chflags nohidden ~/Library

Apple keeps making the folder invisible again with every System update, so it gets tedious re-running the above script. You can automate this by adding a Login Item with an AppleScript "script application" containing the following code:

do shell script "/usr/bin/chflags nohidden ~/Library"

Read detailed instructions for this hint, and download a ready-made script application file on the Red Sweater Blog.

[kirkmc adds: There are any number of ways to unhide the ~/Library folder. Macworld has an article with 18 different methods, plus a few more in the comments to that article. This hint also tells you how you can add this command to your .profile file so every time you launch Terminal it will run. ]
  Post a comment  •  Comments (8)  
  • Currently 3.60 / 5
  You rated: 5 / 5 (5 votes cast)
 
[524 views] Email Article To a Friend View Printable Version
New poll: Does your main Mac have an SSD? Site News
As SSDs become more common, and prices drop, more and more people are either buying Macs with SSDs, or installing them in their Macs. Personally, I started using an SSD with the first MacBook Air in 2008, and bought my current Mac - a Mac mini, purchased in 2011 - with an SSD. The gains in performance are huge, though the price still makes them a choice that is not for everyone.

So, what about you? Does your main Mac - the one you use most - have an SSD? Feel free to post in the comments to the poll which model, whether you bought it with the Mac or installed it yourself, or any other comments you may have about SSDs.

Vote in the poll
  Post a comment  •  Comments (20)  
  • Currently 5.00 / 5
  You rated: 5 / 5 (3 votes cast)
 
[742 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 (7)  
  • Currently 1.00 / 5
  You rated: 1 / 5 (1 vote cast)
 
[627 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 1.00 / 5
  You rated: 1 / 5 (1 vote cast)
 
[445 views] Email Article To a Friend View Printable Version
Open certain preference panes with quick shortcut System 10.7
If you press the Option key, then press certain dedicated keys on the standard Apple keyboard, preference panes will open. This works for Mission Control (Option-F3 or Option-F4), Displays (Option-F1 or Option-F2), and Sound (Option-F10, Option-F11 or Option-F12). The F keys in question are those which act on the given features, either displaying Dashboard or Mission Control (F3 and F4), decreasing or increasing brightness (F1 and F2), or changing or muting volume (F10, F11 and F12). If you use a laptop, you may need to press the Fn key together with the other keys to open these preference panes.
  Post a comment  •  Comments (3)  
  • Currently 4.50 / 5
  You rated: 5 / 5 (2 votes cast)
 
[741 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 (1)  
  • Currently 4.33 / 5
  You rated: 5 / 5 (3 votes cast)
 
[756 views] Email Article To a Friend View Printable Version
Save all of your Terminal activity to a file UNIX
I use Terminal everyday, and I find it a good idea to log everything I you. It makes it much easier to undo your mistakes when you know what those mistakes were. Here's how I do this:

Open Terminal's preferences.

Go to Settings, then Shell. You can choose here to run a command at startup. You could create a simple log of your session using the following:
/usr/bin/script ~/Desktop/Terminal.log
This will log everything you do and append it to the log file.

I like to keep my history so instead I wrote this small script that archives previous sessions by renaming the file with a date/time string. I then set Terminal.app to run at startup the following command:
~/Desktop/logger.sh
Here's the script:
#!/bin/bash
# logger.sh
# Log everything you do in Terminal.

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

#* Archive the previous file
/bin/cp -f ~/Desktop/Terminal.log{,.$FORMATTED_DATE.txt}

#* Begin a new one
/usr/bin/script ~/Desktop/Terminal.log
[kirkmc adds: This is a good idea. I don't use Terminal a lot, but I find that I sometimes need to remember a command I ran in the past which is no longer in my history.

Also, this is similar to something I do with texts I write. I do most of my writing in BBEdit, and I have a number of "scratch" files which I change every year. For example, I have one file for most of what I write, another just for Mac OS X Hints, and another for a specific client I write for. I archive these files at the end of the year, and create new ones. If I ever need to go back to these files to look for something I can do so. I don't bother to enter dates - which I could do easily enough with a TypeIt4Me shortcut - but if I'm looking for something I'll generally know what text to search for.]
  Post a comment  •  Comments (9)  
  • Currently 3.83 / 5
  You rated: 1 / 5 (6 votes cast)
 
[1,172 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 (17)  
  • Currently 4.80 / 5
  You rated: 5 / 5 (5 votes cast)
 
[1,434 views] Email Article To a Friend View Printable Version
View full track info in iOS Music App iOS devices
This hint solves a long standing problem when playing classical music on an iPhone. When using the iPhone Music app (iOS 5.1), the full entry (e.g. name of artist, album or song title) for an item can be too long to be displayed. Tap and hold entry to see the full entry pop up. Tap and drag your finger down the list to make the pop up change as you drag. This works for album titles, song titles, and artists names.

[kirkmc adds: Nice. I hadn't heard of this before, but searching the web shows that it is not totally unknown. Since it hasn't shown up here before, it's worth posting.]
  Post a comment  •  Comments (5)  
  • Currently 4.40 / 5
  You rated: 5 / 5 (10 votes cast)
 
[1,284 views] Email Article To a Friend View Printable Version