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

Regain lost space hidden in trash on external disks System
Think you emptied the trash on your external drive? Even if you did, there may be large amounts of trash still lurking on external or network drives that has not been emptied. As most folks know, the trash is segregated by user ID, and when you empty the trash, it only empties your user's trash -- even on FireWire disks.

If you delete a user's account on your computer, the system won't remove the trash for that user ID on the external or network drive. This can also happen if you have ever shared a disk between two computers. Since the UIDs on one computer may not be the same as the other, trashes can be created by one computer that cannot be emptied by the other. This can even happen if your username is the same on both computers, but your UIDs (e.g. 501 an 502) are different.

Thus periodically one needs to manually remove the trash like this, in Terminal:
$ sudo -s
$ rm -rf /Volumes/"my_external_disk"/.Trashes/*
$ exit
Replace "my_external_disk" is the name of the disk from which you want to remove all trash from all users. (The quotes are used in case of spaces in the disk name.) I noticed this because I had lost about one-third of my disk space to this phenomena, even though I only had one user account on my present computer.

[robg adds: Be very careful with the rm -rf command -- one little typo could be devastating. To make sure you're deleting the right files first, consider running it with the -i option, which will ask you to confirm each file deletion before it happens.]
  Post a comment  •  Comments (4)  
  • Currently 2.63 / 5
  You rated: 4 / 5 (8 votes cast)
 
[16,542 views] Email Article To a Friend View Printable Version
Two ways to possibly close an ARDAgent security hole System
Yesterday, Mac software developer Intego published a security memo on an exposure that exists with the ARDAgent application on OS X 10.4 and 10.5. ARDAgent runs when you use Screen Sharing in 10.5, and if you've enabled Remote Management in the System Preferences panel, but this exploit actually works when ARDAgent isn't running. As far as I know, this exploit was first published on the Apple page at Slashdot, though it probably appeared elsewhere earlier.

You can read the details of the exploit in the Slashdot entry, but basically, it relies on the fact that ARDAgent runs as root and can send AppleScript commands, such as do shell script, to the system it's running on. Given ARDAgent is running as root, any shell script launched by ARDAgent also runs as root, so such scripts run without prompting the user for their admin password and have full access to every file on the system. Obviously, this opens up a huge world of hacking possibilities. Unlike some other exploits, this one will also work on even a lowly guest account; an admin account is not required to take advantage of the security hole.

The good news is that this exposure needs to be exploited either by someone who already has access to your Mac, or by tricking you into downloading and running a program designed to look like something benevolent (known as a trojan horse) -- you can't be hacked by simply reading an email or visiting a malicious web page.

There are two ways to lessen and/or remove your exposure to this security hole.
read more (259 words)   Post a comment  •  Comments (24)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[24,613 views] Email Article To a Friend View Printable Version
One way to help remember keyboard shortcuts System
Did you ever wish you had a better memory? I sure do. Last night I downloaded the keyboard shortcut application Spark, and set to creating shortcuts for my Scripts Menu. Today, I could remember one of the keyboard shortcuts, but not what it does.

Since I can't download a better memory, I tried to think of a quick way to have a cheat sheet readily available. I first tried a text file, but I would have to launch an application each time I wanted to look at it. I thought of embedding the text in a desktop picture, and decided that would be too boring.

What I hit on doing was to take a screenshot of just the text of my cheat sheet, make a new folder with the screenshot inside, and set my screenshot as the background of the folder. Now that folder lives minimized in my dock, and I can pop it open any time I need to 'remember' a keyboard shortcut.
  Post a comment  •  Comments (14)  
  • Currently 1.83 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[10,248 views] Email Article To a Friend View Printable Version
Use an AppleScript to force a desktop picture change System
I have my desktop images set to change every 30 minutes in random order. Sometimes the desktop will display an image that displayed earlier in the day, and I wanted a way to 'advance' the image easily. The following AppleScript will cause the desktop image to change, in whatever order you have set, each time it is run:
property theSwitch : 0
if theSwitch = 0 then
  tell application "System Events"
    tell current desktop
      set change interval to 1801.0
    end tell
  end tell
  set theSwitch to 1
else
  tell application "System Events"
    tell current desktop
      set change interval to 1800.0
    end tell
  end tell
  set theSwitch to 0
end if
To maintain your current change interval, modify the change interval lines to reflect your interval, measured in seconds. Thus, for my 30-minute setting, I used 1801 and 1800 seconds. One hour would be 3601 and 3600, etc. For this script to work, you must have both Change Picture and Random Order enabled on the Desktop tab of the Desktop & Screen Saver System Preferences panel.

[robg adds: This works as described, and is also useful if you just don't happen to like whatever image was randomly chosen. Save the script as an application and drop it somewhere easy to access for a one-click solution. In my case, I put it into a Butler AppleScript action, and assigned it a keyboard shortcut for a no-click solution. I had to change the script somewhat to make it work in Butler, and my image actually toggles twice -- I basically had to remove all the theSwitch references and loops, leaving just two tell application loops.]
  Post a comment  •  Comments (10)  
  • Currently 2.25 / 5
  You rated: 5 / 5 (8 votes cast)
 
[10,996 views] Email Article To a Friend View Printable Version
Create a global shortcut to launch System Preferences System
This is almost not a hint, just one of the smartest keyboard shortcuts I've come up with. Since I don't keep System Preferences in my Dock, I assigned Command-Option-; to launch it from the keyboard. To create the shortcut, open the Keyboard & Mouse System Preferences panel, click on the Keyboard Shortcuts tab, then click the plus sign. In the dialog that appears, leave Applications set to All Applications, set the Menu Title to Preferences..., and enter your desired shortcut in the Keyboard Shortcut box. I used Command-Option-; because it is quite close to the near-universal Command-, shortcut for opening individual application preferences. (Nice touch: in Leopard, the shortcut works immediately!)

[robg adds: This is a very basic hint, but it's a good reminder that the Apple Menu items can all be assigned keyboard shortcuts. For instance, if you move your dock around somewhat regularly, you can assign keyboard shortcuts for the Position on Left/Right/Bottom menu items. (I usually leave my dock at the bottom of the screen, but move it to the right side of my second monitor when using a full-screen app such as Final Cut Express.) Or assign a shortcut to Software Update, to make it easy to repeatedly check for new updates on a day when you're expecting one. Finally, it seems that (as of 10.5, at least), you can also assign keyboard shortcuts for locations in the Location menu. This older hint provided a workaround for older OS X releases, but when I tested a location this morning in 10.5, I was able to activate it via the keyboard shortcut I had assigned to it.]
  Post a comment  •  Comments (7)  
  • Currently 1.71 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[15,122 views] Email Article To a Friend View Printable Version
10.5: Set a FireWire drive's mount point System
This is a tutorial on how to automatically mount your FireWire drive to a custom mount point on OS X 10.5 Leopard. Variants will probably work with USB 2.0 drives, and internal SATA drives, and probably for IDE drives for G4 or G5 Macs. For this, you will need a little familiarity with the UNIX side of OS X, and more specifically, with the Terminal application. You will also need to know how to use vi, I think (though there's a very brief primer included in this hint). If that is beyond you, then you probably shouldn't be reading this.
  1. Connect your FireWire drive and then log in to your favorite account to mount the FireWire drive.
  2. Get the UUID of the drive in Terminal; MyFWDrive should be replaced with the name of your FireWire drive: diskutil info /Volumes/MyFWDrive. This command is going to spew out a lot of info, but the stuff you want is on the line that starts with Volume UUID. You want the long identifier afterwords, i.e. A740D396-D42D-3348-BD87-709342F87840.
  3. In Terminal, make your mount point directory: sudo mkdir -p /my/mount/point
  4. Edit your /etc/fstab file the OS X approved way with vifs (in Terminal): sudo vifs
  5. Add something like the below line to the file:
    UUID=A740D396-D42D-3348-BD87-709342F87840 /my/mount/point hfs rw 1 0
    /my/mount/point is the mount point you just created, and the string after UUID= is the UUID you found earlier. As a brief primer, here's how you do the above in vi. When vifs starts up, hit Shift-G to go to the end of the file. Hit the o key to go into insert mode on a new line. Paste in the above line (with changes as necessary, of course). Hit the the Escape key to get out of insert mode. Type in :wq to save and quit the vifs session (don't forget the : before the wq).
read more (211 words)   Post a comment  •  Comments (16)  
  • Currently 2.29 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[31,637 views] Email Article To a Friend View Printable Version
Eject all locally mounted disks via AppleScript System
If you're like me, you tend to install several updates and/or software packages at once. When through, I like to eject all my mounted disk images with a simple AppleScript:

tell application "Finder"to eject (every disk whose ejectable is true and local volume is true and physical size < 1.0E+9)

Technically, this doesn't look for mounted DMGs but rather for ejectable, local (ie, non-network) disks with a size less than about 1GB. For most purposes, this will do the job. Copy and paste the above into Script Editor and save the resulting script in ~/Library/Scripts, then access it from the Scripts menu. Alternatively, add it to your tool bar, side bar, or assign it a hot key (with a third party hot key program), etc.

[robg adds: As this script only checks for size and ejectable status, it may have unintended results depending on your system configuration. When I ran it, it ejected one (but not both) of my mounted CDs, but didn't eject the Time Machine disk. I would expect mounted FireWire drives may also be ejected.]
  Post a comment  •  Comments (5)  
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[11,291 views] Email Article To a Friend View Printable Version
Restore Dashboard widgets' locations after resolution change System
Widget positions can get mixed when you display Dashboard using a lower display resolution than your usual resolution. In order to restore your widgest back to their previous state, you need to first save their current positions. So prior to changing resolutions , copy ~/Library » Preferences » com.apple.dashboard.plist to another location.

After doing whatever it is you wanted to do at a lower resolution, return to your original display resolution, then copy the backup you created back over the current file.

Finally, type killall Dock in Terminal to force the system to reload the original positions of your Dashboard widgets.
  Post a comment  •  Comments (0)  
  • Currently 2.11 / 5
  You rated: 5 / 5 (9 votes cast)
 
[9,294 views] Email Article To a Friend View Printable Version
Move and resize app windows via AppleScript System
I'm a neatness freak, and I hate lots of messy overlapping windows everywhere. But I'm also a keyboard junkie, and I hate using the trackpad a lot. And I don't want anymore background processes hogging memory, or more applications to open for such a simple task -- so what to do? Answer: AppleScript. I wrote a collection of AppleScripts that use System Events to control the window size and position of the frontmost application. Also, the window snaps to a grid to make it easy to place next to other windows without overlapping.

You can find the scripts on my iDisk public folder (Go » iDisk » Other User's Public Folder, then enter phildooher). Download the zip file and put the (nine) scripts in your usual script folder. The scripts are known to work on OS X 10.4.11, but are untested on 10.5. [robg adds: I tested a few of these, but not all, on 10.5, and they seem to work as described.]

Assign keyboard shortcuts to these scripts (using Quicksilver or your other favorite tool), and you can move and resize many application windows without using the mouse. Also, there is a 'Finder window 1 remember position' script to stop those pesky Finder windows wandering about after closing. These scripts work in many apps, including at least these: Finder, Safari, Mail, Firefox, TextEdit, Script Editor, Preview, OpenOffice Aqua, Skype, and many others. They don'e seem to work in iTunes, NeoOffice (window 1 resizes, but no scroll bars), and Word 2004. Apps that require specific window sizes, or have floating windows, can be uncooperative. QuickTime Player usually resizes windows proportionally, so video playback might fit to the window instead of being the correct aspect ratio. There is more info on how the scripts work inside the scripts (especially the 'Frontmost application window snap to grid move left' script).
read more (348 words)   Post a comment  •  Comments (13)  
  • Currently 2.38 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[40,749 views] Email Article To a Friend View Printable Version
Temporarily suspend energy saver settings via script System
When watching videos in QuickTime Player and DVD Player, the screen saver and energy saver are automatically suspended, but not so if you're watching full-screen Flash video -- using the BBC iPlayer, for example. This AppleScript takes care of that problem:
(*
    Suspend Energy Saver © RickoKid 2008
    Version 0.1
  
    TODO: Change so that authentication only has to be given once for non-administrator users, no matter how long suspension is in place.

  
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*)

set userPass to ""
set battState to {powersource:"Battery", sleep:"", displaysleep:""}
set acState to {powersource:"AC Power", sleep:"", displaysleep:""}

if (do shell script "id -Gn") contains " admin" then
  (*  If user is admin, ask for password.  Otherwise, leave it to the system
    to ask username and password of an administrator (which will
    probably time out and ask again when ending suspension.  *)
  
  display dialog "Please type your password" default answer "" default button "OK" with hidden answer
  set userPass to text returned of the result
end if

set pmState to (do shell script "pmset -g disk") -->  Get current settings for both Battery and AC Power, and Screen Saver timeout. 
set saverState to (do shell script "defaults -currentHost read com.apple.screensaver idleTime") as number
repeat with stateSetting in paragraphs of pmState
  if stateSetting contains "Battery" then --> write following values to the battState record
    set powersource to (a reference to battState)
  else if stateSetting contains "AC Power" then --> write following values to the acState record
    set powersource to (a reference to acState)
  else if stateSetting contains " sleep" then
    set sleep of powersource to (word 2 of stateSetting)
  else if stateSetting contains " displaysleep" then
    set displaysleep of powersource to (word 2 of stateSetting)
  end if
end repeat

-->  Disable sleep, displaysleep and screen saver for both Battery and AC Power
if userPass is not "" then (do shell script "pwd" password userPass with administrator privileges) --> If we have a admin password, activate it.
set battSleepResult to (do shell script "pmset -b sleep 0" with administrator privileges and password)
set battdisplayResult to (do shell script "pmset -b displaysleep 0" with administrator privileges and password)
set acSleepResult to (do shell script "pmset -c sleep 0" with administrator privileges and password)
set acdisplayResult to (do shell script "pmset -c displaysleep 0" with administrator privileges and password)
set ssResult to (do shell script "defaults -currentHost write com.apple.screensaver idleTime 0")

display dialog 
  "Sleep and Screensaver are now temporarily suspended." with title 
  "Energy Saver Suspended" buttons {"Resume"} default button "Resume" with icon 1

-->  Re-enable sleep, displaysleep and screen saver for both Battery and AC Power, by restoring the saved settings.
if userPass is not "" then (do shell script "pwd" password userPass with administrator privileges) --> If we have a admin password, activate it.
set battSleepResult to (do shell script "pmset -b sleep " & sleep of battState with administrator privileges and password)
set battdisplayResult to (do shell script "pmset -b displaysleep " & displaysleep of battState with administrator privileges and password)
set acSleepResult to (do shell script "pmset -c sleep " & sleep of acState with administrator privileges and password)
set acdisplayResult to (do shell script "pmset -c displaysleep " & displaysleep of acState with administrator privileges and password)
set ssResult to (do shell script "defaults -currentHost write com.apple.screensaver idleTime " & saverState)
The above script will temporarily suspend the Energy Saver and screen saver until you click the Resume button. If you're logged in as an administrator, you'll need to provide your password first. (The original version of this script can be found in this post on my site.)

[robg adds: I haven't tested this one...]
  Post a comment  •  Comments (8)  
  • Currently 1.25 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[12,575 views] Email Article To a Friend View Printable Version