About these ads

Blog Archives

eject all your disks at once

script menu

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:

eject

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.

AS prefs
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’. :)

About these ads

FastTasks – a utility for ten common terminal tasks

FastTasks

If you find you only ever go into Terminal to perform a small number of tasks that can’t be done (easily or at all) in the OS X graphical user interface, this little utility could be for you. It allows you to run a number of common tasks such as

reveal and hide hidden folders
batch change the extension on multiple files
purge system free memory
flush the DNS cache
restore system preferences to defaults

without having to bother looking up the commands. You will, however, have to do a little Terminal ‘dirty work’ to initially get the utility up and running (it’s a shell script which you need to turn into an executable file), but step by step instructions are all provided. ;)

Here’s what you do:

1. Copy or download the entire script from here FastTasks code and paste it into a text editor (TextEdit or Tincta, my favourite, will do).

2. Save the file as plain text onto your desktop with the name ‘FastTasks’

3. Open Terminal.app and paste this command:

sudo chmod 755 ~/Desktop/FastTasks

and press ‘return’ on your keyboard. You’ll be asked for you Admin password which will be invisible when you type it. If you’re wondering what you’ve just done, you’ve just changed that plain text file into an executable program.

4. Paste the next line into Terminal.app

cp ~/Desktop/FastTasks /etc/bin/FastTasks

then press ‘return’ on your keyboard.

As a result of that last command, you can now use the script by typing ‘FastTasks’ in a Terminal window or by double-clicking ‘FastTasks’ in Finder or on the Desktop.

5. By the way, if the Terminal window remains open after FastTasks has completed, change the following settings in Terminal’s Preferences:

Preferences > Settings > Shell > When the shell exits…

and change the dropdown menu from ‘Don’t close the window’ to ‘Close if the shell exited cleanly’.

And that’s it. You can now run any of the tasks in the menu without having to know the commands! :)

Fast tips for using FastTasks

1. FastTasks is actually quickest to run by using Spotlight and Terminal.
If you have the Spotlight hotkey set up (usually cmd-space by default), simply open Spotlight, and type ‘Term’ and hit ‘return’ on the keyboard. At the Terminal prompt type ‘fasttasks’ and hit ‘return’.

2. Running it this way has another benefit. If you want to run FastTasks again after performing one task, just hit the ‘up’ arrow on the keyboard (hitting the ‘up’ arrow repeatedly will take you through previous commands entered at the Terminal prompt. Use the ‘down’ arrow to go forward), then ‘return’ when you see ‘fasttasks’ on the command line.

‘delete’ doesn’t send files to Trash

Image

 

If you find deleting a file deletes it immediately without sending it to the Trash first, you may need to fix permisssions on your Trash folder. 

Open Terminal (Applications > Utilities > Terminal.app) and type

ls -alF

Scroll up if necessary to the beginning of the list and you should see a couple of folders whose names begin with a dot.

.Trash
.Trashes

Ignore .Trashes, but look at the permissions on .Trash, they should read like this (also see the pic above):

drwx- – - – - – <your_username> staff (size) (date) .Trash/

Ignore the numbers, but if the permissions are different or the username is not your account username, then do the following:

At the Terminal command prompt, type the following, replacing ‘your_username’ with (yep, you guessed it…) your username.

sudo chown -R your_username .Trash

For example, if my user name is ‘SnowLpd’ I would type
sudo chown -R SnowLpd .Trash

Then press ‘Return’. You will need to enter your password, which will be invisible when you type it (so type carefully). Now go and test your ‘delete’ function to see if the problem is cured. :)  

 

Related Posts

why does Trash ask for a password? (Permissions Part 1)

 

 

how to fix permissions (Permissions Pt 2)


(This post continues from here on file permission problems.)

Did you know there are two levels of permissions on your mac? User level and system level. Most discussions of fixing permissions only discuss the latter, but you may also need to fix the former (also sometimes called ‘ACLs’) for some problems caused by upgrading Lion on top of Snow Leopard.

4. System Level Permissions
You can safely repair your system level permissions at any time, and doing it once in a while is a good maintenance activity even if you’re not experiencing any problems. It’s also the first thing to do as soon as you notice any problems with apps launching, file access problems, or your computer seems to be running unusually slow.

How to do it:
— 1. Go to Applications > Utilities > Disk Utility.app and double click the app to open it.

— 2. Click your HDD icon in the left column (if you have more than one, click the one that contains your startup disk).

— 3. If it is not already selected, click on the ‘First Aid’ tab. Choose the ‘Repair Disk Permissions’ button near the bottom of the window (see the larger of the two windows in the screenshot above).

— 4. Wait for the process to finish (it could take ten minutes or more), then quit Disk Utility. You can ignore most of the error messages that appear unless they’re in red.

5. User Level Permissions (ACLs)
These permissions apply only to your ‘Home’ folder and its contents, and if you have more than one user you will need to do this procedure for any user experiencing a problem. However, unlike system level permissions, repairing ACLs isn’t something you should do unless there is a specific issue to be solved. Problems that this repair might help with include permission conflicts inherited from an earlier Snow Leopard or Leopard installation, such as Finder always asking for your password when you try to delete, move or copy a file.

To reset the ACLs in Lion: (To reset the ACLs in Leopard/Snow Leopard have a look here.)

— 1. Remove the current ACLs by opening Terminal.app (Applications > Utilities > Terminal.app) and copy and pasting this command:

sudo chmod -RN ~

Press return. You’ll be asked for your password. Notice that when you type it in you won’t see anything on the screen. Press return again. If you get an error message, you probably didn’t type in your password correctly. Repeat this step till its accepted. It will take some time to complete. Then paste this command into Terminal also:

sudo chown -R `id -un` ~

and press return. Enter your password again if necessary.

— 2. Press the Power button on the computer and choose ‘Restart’. When the screen goes blank, hold down the ‘command’ and ‘R’ keys on the keyboard until you hear the start up chime. In the menu bar at the top, choose Utilities > Terminal

— 3. At the Terminal prompt type

resetpassword

Then hit ‘Return’

— 4. Forget about resetting your password; what you’re looking for is your hard disk icon at the top. Hit that, and then from the drop-down menu select your user account.

— 5. Go to the bottom of the dialogue window – leaving all password fields blank – and choose ‘Reset’ under ‘Reset Home Folder Permissions and ACLs’ (see the smaller of the two windows in the screenshot above, inside the red dotted line).

— 6. When the process finishes, quit everything and restart your Mac. :)

revealing the hidden Library

With OSX Lion, Apple decided to make the user Library folder a hidden item. If you don’t know what this folder is for or never use it, that’s probably a good thing. However, for many others, it’s a bit annoying. Here’s a couple of tips for viewing your hidden Library folder.

1. See it only when you need it
If you only need infrequent access to your user/library folder, you might as well leave it hidden and use the ‘Go’ menu in the Finder menubar to get to it.

Hold down the option key while viewing the Menu, and ‘Library’ will appear in the menu list. Release the option key and you’ll see it magically disappear.

2. Change its ‘hidden’ folder status
However, if you want to have your Library folder permanently visible, you need to change its ‘hidden’ status in Terminal.

To do that, open up the Terminal App (in Applications > Utilities) and copy/paste the following command:

chflags nohidden ~/Library

Then press ‘Return’ and quit Terminal. You should now see your Library appear in Finder when you view your Home/User folder.


secrets of the option key

option key

The option key can be used to access some hidden menus in Apple programs as well as accomplish some common tasks more quickly.

There are two ways the option key can be employed, depending on the app and the menu you’re dealing with. Try holding down the option key and clicking on the volume icon at the top of your screen. Notice how it gives you a menu instead of the volume slider? Having problems with your wifi connection and need some technical information? Try opt and click on the Wi-fi (formerly known as’Airport’) icon. See all that greyed out data about your signal that wasn’t there before?

This will only work if you depress the option key before you click the icon. However, in some Apple menus you can click the menu first, and then pressing or releasing the opt key will change some of the available commands. Many of them are subtle, and the best thing to do is play around and explore for yourself, but let’s just take a look at a couple here.

Start with the Finder menu, and compare the two shots below. The one on the left is the ordinary menu. Notice the ellipsis (the ‘…’ ) in the ‘Empty Trash…’ command?





An ellipsis after a command tells you that clicking on it will not execute the command but take you to another menu or dialogue box. In the case of Trash, as we know, that’s just the confirmation box. Thing is, how many times do you ever click ‘Empty Trash…’ with the intention of saying ‘No’. Well, for me, that’s never, so why waste time having to deal with an unnecessary dialogue box?

Now look at the menu on the right. This is what appears if you hold down the option key either before or after clicking the menu. Notice the ellipsis has gone. That means that clicking ‘Empty Trash’ will execute the command immediately, skipping the confirmation dialogue completely.

OK, now you’ve got the idea, go through all the Finder menus (File, Edit, Window, etc). Alternately press and release the opt key and see how the menus change. You can explore the secrets of the opt key in other Apple apps too, including Safari. One I like there is [Safari] File > Close Tab changes to ‘Close Other Tabs’ with the opt key.

Finally, I posted earlier on how to disable Resume permanently. Remember, you can also use the option key to force the App to forget what you were doing. In any Apple app, just hold down the option key when you click Quit from the App menu, or use the hotkey combination ‘Opt + Cmd + Q‘.

Nice. :)

Got any other secret opt-key menus you like? Let us know in the comments!

can’t see your disk space in Finder window?

OS X Lion default doesn’t have the disk space option turned on in Finder.

Annoying, I know. :| but easy to fix, just one step :)

1. Select Finder, then go to View > Show Status Bar



Then you’ll be able to see your disk space:





%d bloggers like this: