Category Archives: Finder
Sometimes when you try to eject a disk, unmount a volume or empty the Trash, you get caught out by some app or process that’s using the file and won’t release it. This is usually signalled by a warning dialog telling you the said file is “in use” or is “locked”.
Part of the difficulty of dealing with this problem is that the warning message may not actually tell you which process is hanging on to the file or give you any options on what to do next to solve the problem.
Sounds like a job for a quick bit of bash scripting then!
We’ll write a one-stop script that leverages a few different command line utilities to help us out here. First, our script will call
fuser to report the processes using the file. Then it’ll use
ps to get those processes’ ID numbers and, after asking us to confirm what we want to do, it’ll feed those to the
kill command to quit them and release the file.
To use it, save the script as a plain text file in the root of your home folder (alternatively, save it in an
/sbin folder. You can do
echo $PATH on the command line to get a list of places you can save it to if you’re not sure).
Secondly, give it executable permissions with
chmod +x <script name>
When the problem strikes, jump into Terminal and type
Add a space, then type or drag the file from Finder onto the command line and hit ‘return’ if necessary. The script will do the rest.
In the image below, I first gave my script (named ‘releaseFile’) exec permissions. Then I called it and chose ‘a’ to quit all processes holding on to the file (in this case, only one process).
Hope that helps. Enjoy! 🙂
UPDATE: this method should no longer be necessary. See the Comments below for the latest.
If like me, you’re not impressed with Dropbox drawing huge green blobs all over your Finder windows without even asking, here’s a great tip from Zackary Corbett for getting rid of them. Run the following line in Terminal:
pluginkit -e use -i com.getdropbox.dropbox.garcon
Thanks Zachary 🙂
Reveal is a one-click toggle switch to show/hide hidden files in the Finder. Unzip it, pop it in your Applications folder and drag it to your Dock for quick access. You may need to override your GateKeeper settings the first time you run it if you have those set to ‘App Store & Identified Developers’ or stricter. Don’t worry! So long as you download it from here, I personally guarantee it’s safe (I wrote it myself!). Best of all, it’s free, so enjoy!
One neat little feature of Quick Look is that if you want to copy some text from one pdf, rtf, or txt file (as far as I can tell, it doesn’t work with .doc and .docx) to another without opening the source file, you can browse through the Finder, hit the spacebar, and select the text from within the Quick Look preview.
However, if you find that you can’t select text inside a QL preview window, you may need to enable it in your defaults settings. To do this, triple-click the line below, copy and paste it into a Terminal window and hit ‘return’.
defaults write com.apple.finder QLEnableTextSelection -bool true
No matter how many times I visit this page, I always find something new that I hadn’t tried before. So the title of this post is more of a suggestion than a description. Why not take a poke around Apple’s shortcut list and discover ten that you don’t already know? I’m going to give a quick round up of ten shortcuts that I use on a regular basis.
1. ⌘ ⌃ Space
Command-Control-Space is a universal shortcut (i.e., you can use it no matter what application is currently active) for bringing up the character viewer (see the screenshot, top of page). In order for it to work, the cursor must be in a text field where character entry is possible, but you can use it literally anywhere: text documents, search fields, browser bars, save dialogs, etc. I used it heavily in creating this post!
2. ⌘ ⌃ ⏏
Command-Control-Eject saves you having to trawl all the way up to the icon top left of your screen and choose ‘Restart…’. It’ll give you the chance to save any unsaved work or cancel the shutdown. This shortcut has a cousin, too: add the option key (⌘ ⌥ ⌃ ⏏ ) to the mix and you get Shutdown instead of Restart.
3. ⌘ ⌫
One of my pet annoyances is continually being asked if I want to save ‘Untitled’ documents, those that I’ve never saved before, when trying to quickly quit an app. Having to take my fingers off the keyboard to move the cursor down to that ‘Delete’ button is time-consuming, and tabbing to it takes multiple hits of the tab key. Fortunately, ‘Command-Delete’ will let you discard the document immediately from the keyboard in one quick shot.
4. ⌘ G
Most people are familiar with invoking ‘Find’ on a page by using ‘Command-F’, but have you ever got annoyed by having to mouse up to those tiny little jump arrows in order to cycle through the hits?
Save your eyes and use Command G instead! Note that you have to invoke Find with ‘Command F’ first.
5. ⌃A, ⌃E, ⌃K
That’s three separate shortcuts not one! In any text field, Control-A moves the cursor to the beginning of the line; Control-E moves it to the end, while ⌃K deletes everything from the cursor to the end of the line. Old-hands of the Terminal and other command-line utilities will know these well, but even they may be surprised that these work across a wide-range of GUI apps, too. Particularly useful in Web browser address bars, search fields, Spotlight and so on.
6. ⌘ L
Command-L in Safari and other browser-based apps (including Xcode’s Documentation viewer 😉 ) will immediately move the focus to the address bar/search bar and allow you to edit its contents. No clicking necessary!
7.⌘ ⌃ 1, ⌘ ⌃ 2, ⌘ ⌃ 3
Three commands new for Safari’s sidebar. Respectively, open the sidebar with Bookmarks showing, with Reading list showing, and with Shared links showing. Hitting the same shortcut again toggles the sidebar closed. Note that those are the numbers ‘1’, ‘2’ and ‘3’, not F1, F2, F3.
8. ⌘ ⇧ A, ⌘ ⇧ U, ⌘ ⇧ H, ⌘ ⇧ D
Again, that’s 4 different shortcuts, this time for the Finder. OK, hands up all those that switch to the Finder, hit Command-N to open a new window, and then click to their Desktop? Save yourself the grief (and the time), just activate Finder and hit Command-Shift-D. No need to open a window first, the shortcut will open a new window for you showing your Desktop folder. The others do the same thing but for different folders: Command-Shift-A opens your Applications folder, Command-Shift-U the Utilities folder, Command-Shift-H opens your Home folder.
9. ⌘ F1
This one’s for those of you with dual monitors or when your Mac is hooked up to a projector. Command-F1 toggles between mirroring and separate monitor views. Great for presentations.
10.(fn) ⌃ F8
Control-F8 activates the Status bar (top right row of icons on your screen). Use the left/right arrow keys to move along them, and the up/down arrows to select things in any menu. Hit ‘enter/return’ to perform the action. Note that on laptops you may need to invoke the fn ‘Function’ key, depending on your settings in Keyboard Preferences.
This is a great one for turning on/off Bluetooth, Wifi and checking Mavericks’ new Energy monitor in the Battery/Power icon. Mostly though, I use it for manually starting Time Machine backups or entering TM’s “star wars” interface (oh, and as a bonus…note that (fn) ⌃ F2 activates the other side of the menu bar (i.e., the menu). Enjoy!
Got your own favourite shortcuts? Tell us what you use most in the Comments! 🙂
One of my favourite new commands in Mavericks is Finder’s ‘Merge All Windows’. You can find this in the Finder’s menu bar Window menu, but note that it’ll be greyed out if you only have one Finder window open (one of my other new favourites is
⌘ ^ space. Try it in Text Edit or Safari’s search bar, but I digress…:p).
To see ‘Merge All Windows’ in action, open up two or more Finder windows. Throw one or two on different Desktop spaces for good measure, then hit the ‘Merge All Windows’ command.
Yes, you get all your open windows from wherever they’re distributed slamdunked into one window with multiple tabs. If, like me, you work across multiple monitors and have multiple desktop spaces on each, Finder windows can rapidly start to multiply and this command is a real boon.
In fact, I like the ‘Merge All Windows’ command so much I even made a shortcut for it in System Preferences > Keyboard > Shortcuts (see the screenshot at the top of the page)
One final trick while we’re on the subject of tabs in Finder windows, note that you can open any folder item in your Sidebar into a new tab automatically by holding down the ⌘ ‘Command’ key and clicking on the Sidebar folder item.
While professional troubleshooters will use software like fseventer or the Instruments.app that comes as part of Xcode, there’s an easy way for anyone to see which files have recently been accessed on their Mac.
1. Open any Finder window and hit ‘command-F’.
2. Click the ‘Kind’ button and choose ‘Other’ at the bottom of the menu:
3. Next, scroll down the list till you see ‘System files’ and check the box and hit ‘OK’.
4. Change the button that says ‘aren’t included’ to ‘are included’.
5. Now hit the little ‘+’ button over on the right side of the window.
6. Again, change ‘Kind’, this time to ‘Last Modified’ and change ‘within last’ to ‘today’.
7. Finally, go to Finder > View menu at the top and choose ‘Arrange By > Date Last Opened’.
You can save the search in the Sidebar for convenience. Give it a more useful name like ‘latest changes’ or ‘fs events’ (“fs” stands for filesystem) and click on it whenever you need to check what’s just happened to your Mac! 🙂
Here’s a simple AppleScript one-liner that can be useful if, like me, you have several disks connected to your laptop at home or the office and you need to get up and go quickly.
1. Open the AppleScript Editor.app by typing
Apples in the Spotlight search bar and hitting ‘return’.
2. Copy the following code into the editor window:
3. Hit ‘Command-K’ to compile and ensure you didn’t make any mistakes. Fix any typos if it doesn’t compile and try again. Save the script to your Desktop as ‘EjectAll.scpt’
4. If you don’t already have the Scripts menubar icon visible in your menu bar, hit ‘command ,’ (that’s the Command key and the comma key) and check the ‘Show Script menu in menu bar’ item in the General pane of AppleScript’s Preferences window.
5. From the Scripts menu, choose ‘Open Scripts Folder > Open Computer Scripts Folder’ and drag ‘EjectAll.scpt’ from the Desktop to the Computer Scripts Folder. You’ll need to authenticate with an Admin password to complete the move.
And that’s it. Now whenever you want to eject every disk with one simple operation, just hit the Script menu icon and click on ‘EjectAll’. 🙂
One of the features I really love in OS X is the ability to preview anything by selecting the file in finder and pressing the spacebar – formally called ‘Quick Look’ – without actually having to open the full app. This is great for both music and movies.
However, if you uninstalled Perian or Flip4Mac or haven’t updated them recently, you will find that a lot of movie files – like .avi, for example – which are not fully supported in QuickTime won’t preview. The answer is to get the latest versions of these two plug-ins:
(hit the green download button (free), ignore the one trying to sell you a paid version).
You should then be able to see any movie using Quick Look.
QuickTime won’t play my video