Category Archives: Mountain Lion

how to log out another user without logging in – updated

Screen Shot 2016-04-30 at 20.35.31

Posted: 10th May, 2013

If you have multiple accounts on your mac, you may sometimes wish to log out one or more of those accounts without actually having to sign in to them first via the fast user switching menu. There’s a couple of ways to do this. First, if the issue is just that you want to shutdown the computer, you can log out all users by entering an Admin user name and password when this dialogue automatically appears after hitting ‘Shutdown’ (it won’t appear if no other users are logged on):

log out window

However, there are times when you may just want a quick way to log out users without shutting down and without wasting time logging in to their accounts first. Be aware that in killing a user’s process without logging in to the account first, any data in that user’s account that is not already saved (or autosaved) will be lost. If you’re sure that’s not a problem, then follow this short procedure manually or use the AppleScript version that follows:

1. Open up Activity Monitor (/Applications/Utilities/Activity Monitor.app)

2. Use the drop down menu in the Task bar to change the menu to ‘Other User Processes’  (note: you can use ‘All Processes’ in the menu if you wish, but that is less safe as it makes it possible to accidentally click on your own user process in step 4 below!).

3. In the filter bar, type loginwindow.

activity monitor

4. From the list of users that show up, for each one that you wish to log out:

  • click on its row in the Activity Monitor pane to highlight the process
  • press the ‘Quit Process’ icon in the Task bar above
  • from the resulting dialogue window, click ‘Force Quit’
  • supply an Admin password if requested.

Repeat for any further accounts that you wish to quit. (Tip: If you want to kill the ‘Guest User Account’, you’ll need to switch back to ‘All Processes’ and kill the loginwindow assigned to the ‘root’ user).

And that’s it. Your unwanted users are now logged out! 🙂

Update 30th April, 2016: If you get tired of doing this manually, you can log out all other real users at once with this AppleScript:

set thisUser to do shell script "whoami"
set usrList to paragraphs of (do shell script "ps caux -o args | grep loginwindow")

repeat with i from 1 to number of items in usrList
set this_item to item i of usrList
set thatUser to word 1 of this_item
if thisUser is not equal to thatUser then
set theProcessNum to word 2 of this_item
do shell script "kill -9 " & theProcessNum with administrator privileges
end if
end repeat

FastTasks version 1.18 released! 💥

FastTasks v.118

I’ve just posted an incremental update to my free system utility, FastTasks. The update fixes a bottleneck in the launch code that caused FastTasks to take excessively long to load. I’ve also added the System Uptime, which you can also refresh with the new keyboard shortcut, ‘command-U’.

FastTasks saves you having to role up your sleeves and get mired in the exotic world of Terminal’s command line for a number of common tasks. FastTasks v1.18 offers you system info down the left side of the panel, all of which can be updated by the shortcuts displayed on the panel, and access to some common Terminal commands on the right.

If you haven’t tried FastTasks yet (or got tired of the slow launch times with the old version), this is a great time to grab a free copy of v1.18 as I’ll soon be replacing the app by FastTasks 2.0, a paid-for app with a whole new interface and extra functions. Nevertheless, support for FastTasks 1 will continue and bug fixes will still be forthcoming as necessary. Grab it while you can, folks! 🙂

Download FastTasks v1.18 from here…

Note: FastTasks requires OS X 10.6.8 or higher


run Terminal commands from any app

In this post I’m going to show you how you can select a piece of text in any app and have it run in Terminal simply by hitting a hotkey. The trick is especially useful for running commands you find on websites (like this one!) in a browser like Safari or Firefox.

This 20-second clip demonstrates running a command from a Firefox browser and another one from TextEdit, but you can also do it from an AppleScript editor window (and indeed any app that has selectable text), which can be useful for testing the formatting of your ‘do shell script’ commands and the like:






The first thing you’re going to need is to create an Automator workflow, add an AppleScript action and insert some code. Really? Nah, just kidding. I did it for you. 🙂 Just download, unzip and double-click the .workflow file to install the completed Service:

Download Run in Terminal.workflow.zip

Click through the various dialog boxes and choose ‘Install’ on the last one* (note for Snow Leopard users: the service will open directly in Automator; just do ‘command-shift-S’ to name it and save it).

Screen Shot 2014-05-09 at 12.10.58

All you need to do now is set the hotkey. Open  > System Preferences.. > Keyboard | Shortcuts and click ‘Services’ in the sidebar. Scroll down the window till you see the ‘Run in Terminal’ command. Click on the far right to add a shortcut of your choice. The one I used in the video is ‘command-option-control-T’ (‘T’ for ‘Terminal’ helps me remember the shortcut).

To use the Service, just highlight any Terminal command by triple clicking it and pressing your hotkey. Try this one,

cd ~/Desktop; ls -alF

which lists all the visible and invisible files on your Desktop, as a test.

You can also get to the Service from both the contextual menu (right-click > Services) and the application menu bar at the top (e.g., Safari > Services).

As a bonus, try out your new Service on the Terminal command in this post, and now you’ll be able to run Terminal commands even from Quick Look previews in Finder!

Enjoy! 🙂


Carbon Copy Cloner: see last back up date

CCC Last Backup Service

If you’re a user of Bombich Software’s excellent Carbon Copy Cloner but you’re not doing backups as scheduled tasks, you may wish there was a way to find out the last time you successfully completed a backup task.

Unfortunately, CCC doesn’t provide an easy way for users to see this information natively, but in this post we’re going to add it through a bit of AppleScript and Automator magic.

As it turns out, CCC does keep a log of all your past backup details stashed away in a CCC.log file buried in your local domain’s Library folder. You can view this file in Console, but it’s a bit of a pain. Wouldn’t it be nicer if you could just hit a hotkey like ‘Command-Control-C’, say (you know, for ‘CCC’ 🙂 ), and get a dialog box like this:

CCC Last Backup date
If you think so too, then download my Automator workflow:

For Lion, Mountain Lion and Mavericks:
Download for 10.7.5 thru 10.9.2 📀

For Snow Leopard:
Download for 10.6.8 💿

Double-click on the .zip file and double click again on the unzipped workflow file. You’ll get a warning message saying that you’ve downloaded the file from the internet (from me, actually!). After clicking ‘Open’ to dismiss the warning, for all users except 10.6, click ‘Install’ on the the following dialog box:

Install workflow

After clicking ‘Install’, click ‘Done’ to dismiss the confirmation dialog box that pops up.

For those of you running Snow Leopard (10.6.8), after clicking ‘Open’ the workflow should open in Automator. Hit ‘command-S’ to save it as a Service.

For all users, if you now click up to any application name next to the  Apple near the top left of your screen (see the screenshot at the top of this post) and scroll down to ‘Services’ you should see the new Service already there. If you don’t, try logging out and logging back in to your user account.

Once you can see the workflow in the Services menu, go ahead and give it a click to test it out. 🙂

A couple of notes on usage:

Carbon Copy Cloner does not have to be open for the Service to work.

The date format display is YYYY-MM-DD.

If you want to add a shortcut key as suggested earlier, open up System Preferences > Keyboard and click the ‘Shortcuts’ tab. Down the sidebar you should see ‘Services’. Click on that and scroll way down to the bottom till you see the name of the Service. Click ‘Add Shortcut’ and hit the keys you want to use. I like ‘command-control-C’ as it’s an easy mnemonic for ‘Carbon-Copy-Cloner’.

how to correct the external monitor resolution

apple_display
A problem that’s been bugging me since at least Mountain Lion is that sometimes when I connect my external monitor to my Macbook Pro, the display resolution is incorrect. The problem is pretty annoying as it often occurs on wake if the MBP goes to sleep even when the external monitor hasn’t been disconnected.

There are a number of solutions to this problem, and I’ve used them all. Some are less irritating than others, but in this post I’ll give you a run down of the options.

1. The old fridge magnet trick
As I often use a tiny magnet to put my MBP display to sleep while keeping the lid open, normally putting the magnet on and then taking it off again will cause the displays to reset. But this method is annoying both because I’m often connecting to external monitors away from home and because I often misplace that tiny magnet! The other problem with this method is it doesn’t always work… 😦

2. Put the external monitor to sleep with a Hot Corner
Go into System Preferences > Mission Control, and set one of the Hot Corners to ‘Put Display to Sleep’ (not ‘Start Screen Saver’). When your mac wakes up and the monitor is in the wrong resolution, move the cursor to the Hot Corner, wait a couple of seconds, and move the cursor back to the centre of the screen.

3. Activate ‘Detect Displays’
Ok, two ways to do this. The manual way is that you open System Preferences, hold down the ‘option’ key and hit the ‘Detect Displays’ button at the bottom of the window. Note that you won’t see this button unless you’re holding down the ‘option’ key. After the display resets properly, quit System Preferences. My main beef with this method is it’s totally disruptive to my workflow, so much in fact that it makes me angry every time I use it!

Fortunately, you can lower the inconvenience with the second way, which is an AppleScript that does the same thing automagically.

Update Jan 2015:
Partly in response to this problem, I’ve written an app called DisplayDroid which detects when a monitor is connected or disconnected and automatically runs a script in response. The script below is built into DisplayDroid as one of the presets that you can choose!
Find out more about DisplayDroid…

try
tell application "System Preferences" to quit
end try

delay 1
tell application "System Preferences"
activate
reveal pane "com.apple.preference.displays"
end tell


tell application "System Events"
tell process "System Preferences"
set frontmost to true
try
key down option
delay 0.2
click button "Detect Displays" of window 1
delay 0.2
key up option
on error
key up option
end try
end tell
end tell


tell application "System Preferences" to quit

You might want to save this in your scripts menu or make it into a Dock-able app for convenience. Don’t forget you’ll need to allow the AppleScript editor permission to use Assistive Devices.

4. A free screen utility
Unhappy with a GUI scripting solution, I started researching how to change the displays in Cocoa or from the BASH command line so that I could avoid the overhead of System Preferences popping open and closed, which is an ugly solution at best. I didn’t get far in my research before I found that someone else had already beaten me to the punch, and had even offered the code up for free. Y’gotta love the heroes of the programming community! Download the free RDM.app, which lets you change the screen resolution on any of your monitors from the status bar on your desktop. Move it from your Downloads folder into your /Applications folder. I’ve even got it in my login items for maximum convenience!

RDM

Although the app is probably slightly slower than the Hot Corner solution when I’m at home, I like it because I regularly connect my mac to all sorts of other monitors and projectors and the mac doesn’t always choose the best display. The RDM.app lets you slide through the available options much more efficiently than the System Preferences panel, too. Big respect to Paul Griffin at http://www.phoenix-dev.com for this!

5. Trash old prefs
No matter how well or otherwise any of these techniques work, the question remains: why is the resolution setting being forgotten in the first place? I haven’t nailed this down as a cert yet, but ever since I did this to solve a different problem, my monitor’s been behaving itself, too.

1. Go to

Hard Disk/Library/Preferences/System Configuration

Now make sure you’re at the right place because there’s another ‘System Configuration’ folder at /Library/System Configuration, and you definitely don’t want to be messing with that one. Also, this is the Library folder at the root of your hard disk and NOT your user account library (i.e, the path is /Library, not ~/Library). Check that path. Here it is again

Hard Disk/Library/Preferences/System Configuration

2. OK, click on that folder, and copy it over to your Desktop. Now go back and delete it from /Library/Preferences (or hold down ‘option’ while you drag to do a ‘move’. I prefer the first way; it’s safer, if slower).

3. Restart and test.

Hopefully, if you’ve been venting at the ears like me over the external display problem, one or more of these options will help lower the frustration!

🙂

Related Posts:
DisplayDroid from Applehelpwriter



Featured Picture: apple_display by 3DEricDesign

enable TRIM with FastTasks v1.17

FastTasks updated to version 1.17

Update: how to enable TRIM (for Yosemite 10.10.4+)


FastTasks has been updated to version 1.17 to support users who have installed their own SSD drives.

FastTasks now makes it simple to check the current TRIM status of your disk, and to either enable or disable it with a simple click, particularly useful if you find that TRIM has been turned off by an OS X software update or upgrade.

Note that you need to restart your mac after using the radio buttons to change the TRIM status in order to complete the process.

🙂

FastTasks – free download

FastTasks dog opened


I’ve been planning this ever since I first wrote a shell script along the same lines. All it needed was a nice interface, and that’d be something I could use almost everyday. Well, it only took me 8 months to get round to it, but here it is. 😉

FastTasks main window

Download FastTasks»

FastTasks allows you to achieve a number of things that you would normally have to roll up your sleeves and do in Terminal or AppleScript.

The window consists of two columns: left-side for info, right-side for actions. Here’s a detailed breakdown of functions with possible uses.

–Left-side (Info):
OS X Version:
Displays your current OS Version and build number

Startup Disk:
Displays your boot volume
I sometimes forget which particular volume I’m booted into, so this is vital info for me and anyone who’s regularly booting in and out of different installations.

Router IP:
The IP address of your network router
This can be useful for troubleshooting or if you need to access your router’s Admin page.
Just select the address and paste it into Safari’s search bar.

Local IP:
Your node on the local network
Useful to copy and paste if you need your local IP/ network node.

External IP:
How the rest of the world sees you
Very useful if you’re using proxies and want to check whether they’re working.

Installed Ram:
Just a courtesy reminder, but the real value here is the summary of usage stats underneath. These are pretty good approximations to what AM shows on my 10.8, but there are discrepencies on some versions of OS X between what ‘top’ shows and what Activity Monitor shows. FastTasks uses the same information that you’d get if you used the ‘top’ command in Terminal.

By the way, there’s a refresh button (keyboard shortcuts shown) for both the memory usage and network addresses, as the displays do NOT update continuously. Using the refresh buttons does not CHANGE anything on your system: They just update the display to reflect the current state of the system.

–Right-side (Actions):
Show hidden files:
Reveal or hide the hidden files and folders in the Finder whose names begin with a period
This is probably the most useful function of the app as it provides a dead easy way to hide and unhide system files without messing around in Terminal.

Show User Library:
Reveal or hide the User Library in the Finder
Likewise, this hides or unhides the ~/Library folder in Finder. This is ‘hidden’ in a different way from files that begin with a period, and its setting can be manipulated independently of that setting, so you can have the User Library showing, but ‘hidden’ files still hidden.

Flush DNS Cache:
Flush the cache that resolves internet domain names into IP addresses
Flushing the DNS cache can sometimes help resolve problems when you can’t access certain websites. Depending on what system you’re running, you may or may not see a ‘Requires Admin password’ warning next to this button. If you see the warning, then when you press the button the system will ask you for your password. The password request is from OS X and it goes to OS X: It’s not called, seen or stored by the app itself.

Free Memory:
Purge the RAM of inactive memory
Again, depending on what system you’re running, you may or may not see a ‘Requires Admin password’ message. On Snow Leopard, this requires the Command Line Tools supplied with Xcode, so if you see a message telling you to install Xcode, you may have to live without it (availability of Xcode for Snow Leopard these days is a bit hit and miss). You’ll also see the information on the left-side refreshed under ‘Usage’ when you use the free memory function and it successfully completes.

NOTE: on some systems where both Flush DNS Cache and Free Memory display ‘Requires Admin password’, note that after supplying the password for one of those actions, the user will be able to perform the other action without authenticating for a period of around 5 minutes (unless the sudo timeout setting has been altered by an Admin user).

Lastly, at the bottom of the window you’ll see a tiny plea to donate if you find the app useful ;). Note that the underlined text ‘Applehelpwriter’ and ‘Donate’ are hotlinks that if clicked will launch Safari and load a tab with this site and a Paypal donate page, respectively.

I hope you enjoy using FastTasks. Please read the provided Licence and User Guide that are in the download. Thanks! 🙂

Download FastTasks»

Automator: make your own icons

Automator in action

Back around Christmas I posted this little procedure for making your own icons, with the promise that sometime I’d get round to writing it up as a script. Well, reader Cameron Leask has saved us all the effort and created this great little Automator workflow to do just that!

Download the workflow by clicking on the Automator robot below. When the download’s finished (it’s only 2MB), save it in your Applications folder.

To use it, just click on it to run. The first time you do that you may need to override your GateKeeper settings. Once you’ve allowed the app permission to run, choose the image you want to make into an icon and click ‘OK’ or press ‘return’. Cameron’s workflow will do the rest.

After a few seconds, you should see a little confirmation dialog telling you the icon is on your Desktop. Be sure to change the name of your new icon and/or move it to somewhere else before running the workflow again (or the next icon you create will overwrite the previous one).

Click the Automator robot to download:

Automator_Icon








Picture to icon.app

Thanks a million Cameron!

Got your own favourite Automator workflow or AppleScript you’d like to share? I’d be happy to consider posting them on Applehelpwriter. Just drop me a mail.

🙂

how to see recently accessed files

speed


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:

Finder Search menu: Other

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’.

search

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! 🙂

FSEvents


can’t create kext cache error

http://starwink.deviantart.com/art/I-m-not-a-baloon-owner-anymore-35109845

If Console is reporting the ‘can’t create kext cache / owner isn’t root‘ message, complete the following procedure.

1. Run ‘Repair System Permissions‘ in Disk Utility.
Repairing system level permissions won’t solve the kext cache problem, but you’ll want to make sure they are all in order first. There is no need to repair ACL permissions for this procedure.

2. Open Terminal.app
Copy and paste the following:

sudo chown root:admin /

Hit ‘return’ and type in your admin password. This step ensures that the admin user has ownership permissions for everything on the startup disk.

3. Fix the kext cache permissions
Paste the following code into Terminal.app, hitting ‘return’ again and supplying the password if requested (if you do this shortly after step 2 you may not be asked for the password again):

sudo touch /System/Library/Extensions

4. Clear Console log and restart
The next two steps aren’t strictly necessary, but are good practice. Open Console.app, click ‘All Messages’ in the sidebar and hit the ‘Clear Display’ button in the Tool bar. Now, restart your mac.

5. Check for the problem
See if the procedure was successful by opening Console.app again, choosing ‘All messages’ in the sidebar and typing

can't

in the filter/search bar over on the right. If you carried out the procedure above correctly, it shouldn’t return any ‘can’t create kext cache / user isn’t root’ messages since the restart time.

🙂

Featured picture: I’m not a balloon owner anymore by ~starwink

%d bloggers like this: