15 Terminal commands to supercharge OS X

19th May 2009 | 11:47

15 Terminal commands to supercharge OS X

Fire up the command line and get more productive

Tweak your system

Time was that Mac users would stare blankly or visibly shudder when the words 'command line interface' were uttered.

But with Mac OS X being a Unix variant, Apple bundled Terminal right from the start, enabling Mac users to geek out as much as their PC-based brethren.

Although you can replicate the results or functionality offered by most Terminal commands via various bits of freeware and shareware, it's simpler to fire up the command line and paste in a handy command.

Below are our favourites, centring on workflow efficiency and system streamlining and improvements. Note that if Terminal becomes a mess at any point, 'clear' removes everything from the current window or tab.

Terminal commands to tweak your system

Starting with the system itself, here are four workflow-orientated tips:

1. Kill a process

killall [process name]

If a process is misbehaving or needs a restart, use the above command. For example, 'killall Finder' restarts Finder. Note that process names are case-sensitive.

2. Show hidden files

defaults write com.apple.finder AppleShowAllFiles true

This shows hidden files in Finder. Take care to not trash something you shouldn't. Replace 'true' with 'false' to put things back to normal.

3. Force expanded dialogs

defaults write -g NSNavPanelExpandedStateForSaveMode -boolean true

defaults write -g PMPrintingExpandedStateForPrint -boolean true

These commands force expanded dialog boxes for saving (top) and printing (bottom), if an app doesn't already have a custom setting. Use 'false' to reverse the commands.

4. Declutter your 'Open With' menu

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

The 'Open With' menu often gets full of junk. The above command, which must be pasted/typed as a single line, clears it out and starts again.

Tweak the Dock

Terminal commands to tweak the Dock

We've already shown how to improve the Mac OS X Dock, which mentioned one of the commands below. However, other commands exist that improve your Dock and Stacks. When you're done inputting commands, restart the Dock with 'killall Dock'.

5. Make the Dock 2D

defaults write com.apple.dock no-glass -boolean yes

Switch 'yes' to 'no' if you go temporarily insane and hanker for reflective 'glass'.

6. Make hidden app Dock icons semi-transparent

defaults write com.apple.Dock showhidden -boolean yes

This turns Dock icons of hidden apps slightly transparent, making hidden apps easier to spot. Again, 'no' reverses this.

7. Make Dock app icons spring-loaded

defaults write com.apple.dock enable-spring-load-actions-on-all-items -boolean yes

Dock stacks are spring-loaded, but app Dock icons aren't. To change this, use the above command. This unhides and focuses an app when you hover an item over its icon.

8. Turn on stacks highlights

defaults write com.apple.dock mouse-over-hilte-stack -boolean yes

When a stack is set to 'Display as Stack', a highlight appears behind icons when you navigate using the keyboard. The above command forces the highlight to appear when using the mouse also.

9. Create recent-item stacks

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'

Make sure the above is pasted as a single line. On restarting the Dock, you'll see a stack next to Trash. Click-hold and you can set it to show recent apps, documents or servers, or 'favorite' volumes or items. Run the command again for further instances that can be set to different display options.

BETTER DOCK: Add stacks for recent items, servers and documents to the Dock via a Terminal command

Tweak your OS X dashboard, and more

Terminal commands to tweak Dashboard

Some Mac users hate Dashboard so much they want rid of it, whereas others want widgets to stay put when Dashboard closes. The following tips enable these things. Use 'killall Dock' after entering commands for changes to take effect. (Dashboard is part of the Dock process.)

10. Disable Dashboard

defaults write com.apple.dashboard mcx-disabled -boolean yes

Reverse this by using the same command, but replace 'yes' with 'no'.

11. Drag widgets to the desktop

defaults write com.apple.dashboard devmode yes

This command activates developer mode for Dashboard. Once it's active, click-hold a widget and close Dashboard. The widget will stay put, floating above other windows. To put it back, click-hold, open Dashboard and 'drop' the widget. (This is fine for one-offs, but if you're a massive widget junkie, consider buying Amnesty Singles, a $10 app that converts widgets to Mac OS X applications.)

DESKTOP WIDGETS: Activate Dashboard's developer mode via Terminal to put widgets on the desktop

Terminal commands for better screen grabs

Mac OS X bungs screen grabs on the desktop in PNG format. When taking multiple grabs, regularly moving them is annoying, and you might prefer a different format...

12. Change your screen grab format

defaults write com.apple.screencapture type jpg

Alternate formats are 'tiff' and 'pdf' or the default, 'png'. Logout and back in for changes to take effect.

13. Amend your screen capture location

defaults write com.apple.screencapture location [path]

If you don't fancy typing a full path, add a space after 'location' and drag a folder to Terminal from Finder - the location will be added automatically. Again, a logout/login will be required for this change to be made. An eminently sensible place for screen captures is a folder within /Pictures.

DRAG AWARE: Terminal is drag aware, so you can add paths by dragging a folder from Finder

Terminal commands to make your Mac more fun

14. Make your Mac talk

say [string]

Replace '[string]' with some words to make your Mac talk.

15. Play Tetris

This isn't a Terminal tip per se, but you can use Terminal to access Emacs and play a skinny Tetris. Type 'emacs', hit Return, wait for Emacs to load, hit Escape, type 'x', then 'tetris' and then Return. Arrow keys and Space control the tetronimos.

Finally, if you have an aversion to typing, many of these changes can be done via TinkerTool and Secrets, but Terminal is where the action's really at for a generation of Mac users finally getting comfortable with typing (or at least copying and pasting) the odd command.

-------------------------------------------------------------------------------------------------------

Liked this? Then check out The secrets behind OS X Quick Look

Sign up for TechRadar's free Weird Week in Tech newsletter
Get the oddest tech stories of the week, plus the most popular news and reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register

Follow TechRadar on Twitter

OS X hacks Mac
Share this Article
Google+

Most Popular

Edition: UK
TopView classic version