Mastering Terminal To Hack Your Mac [Feature]



Terminal app can be daunting at first, but it’s really the best way to hack into your Mac’s configurations and preferences to customize things to work for you rather than against you. With the right Terminal commands, you can tweak the Finder, mess with the user interface, build a more private and secure Mac, and even enable features that aren’t officially supported on older Macs.

Here are a few of the better ones.

Hack The Finder

The Finder can be hacked a bit using the Terminal, of course, so we figured we could show you a few tricks, too. Here’s how to hack up the Finder a bit to make it work better for you.

Show Hidden Files
Sometimes you just want to see it all, right?
Sometimes you just want to see it all, right?

The Finder hides many configuration files in the finder, some of which you might want to get into to change things. Most of the time, these files should stay hidden or left alone, but we’re not interested in playing it safe all the time. If you want to see all the files on your Mac for your own reasons, launch Terminal and type or paste in the following command:

defaults write AppleShowAllFiles TRUE

Then, issue the command to restart the Finder (killall Finder) and hit the Return key.

If, after you’ve found the hidden files you were looking for, you want to return the Finder to its pristine, hidden-file state, simply do the same thing, except change TRUE to FALSE, and you’ll be good to go.

Change Screenshot Formats
Sometimes a JPG is all you need.
Sometimes a JPG is all you need.

Taking a screenshot in OS X is as simple as hitting Command-Shift-3 for the whole screen, and Command-Shift-4 for a selection portion of your screen. These screenshots end up on your Desktop in the Finder, and by default are PNG files. If you want to change that default to, say, JPG or PDF, simply type or paste the following command into Terminal.

defaults write type file-extension

Just be sure to change “file-extension” above with the three letter suffix for the file type you want. So, if you want your screenshots to default to jpeg files, simply type or paste the following: defaults write type JPG, and you’ll be good to go.

Show File Path Info
Where the heck am I? Oh. Yeah!
Where the heck am I? Oh. Yeah!

Sometimes, it can get confusing as to where you’re at in the Finder, especially if you have a lot of folders open in windows, and they have similar names. A neat way to remind yourself where you are is to enable the Path View in the title bar of your Finder windows. To do so, simply enter the following into your Terminal app.

defaults write _FXShowPosixPathInTitle -bool YES

Now your Finder windows will all show you the file path structure, so you’ll be able to figure out where exactly you are when you get lost in a plethora of open folders and files. Slick!

Hack The User Interface

Now, let’s look at some commands you can issue in the Terminal to mess around with the user interface, to help you use your Mac the way you want, rather than the way they want. Whoever they are.

Disable Window Animations
Snappier on that older Mac, for sure.
Snappier on that older Mac, for sure.

Mountain Lion has a window animation that make things look slick, but can slow down vital workflow, especially on older Macs. To get rid of this subtle but occasionally annoying feature, zoom up to open animation, and issue the following command into your Terminal app:

defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

Now the windows will just appear without any opening animations, which should help things feel a bit snappier when running OS X on an older Mac. Change false to true to bring it back.

Get Rid Of Smooth Scrolling
Direct scrolling is the new black.
Direct scrolling is the new black.

When you launch a Safari window that needs scrolling and hit the space bar, OS X is set up to animate the scrolling down motion, so it feels smooth and silky. Some users complain about this effect being jerky and unattractive on Retina Macbooks, and would like to disable it. All you need to do is issue the following command into Terminal:

defaults write -g NSScrollAnimationEnabled -bool NO

Now, when you hit the space bar in Safari or other scrolling windows, it will jump right to the next area on the page, rather than animating down. Change NO to YES to get it back.

Dump The Rubber Banding Effect
Too bouncy! Stop!
Too bouncy! Stop!

When you’re scrolling up or down in any OS X application, including the Finder, you may notice a sort of bouncy, rubber-band effect when you scroll past the top or bottom of a page or list too quickly. This mimics iOS beahvior, which is aesthetically pleasing, but it can be annoying at times, or slow down your process on an older Mac. To get rid of this feature, type or paste the following Terminal command:

defaults write -g NSScrollViewRubberbanding -int 0

Now this only works in some apps, so you’ll have to quit them and relaunch to make sure. Safari or Chrome don’t seem to lose the effect, but Finder and Evernote do, so play around with it to see if the apps you want to disable this within will work.

Enable Key Repeats
Get rid of that annoying alt character popup.
Get rid of that annoying alt character popup.

It used to be simple to get a repeated key on your Mac; just hold down any key and it would repeat after a certain amount of delay time. Now, however, in many OS X apps like TextEdit, you can’t do that anymore, as an alternate character popup menu will appear if you hold down a key that has those associated with it. If you want to get rid of that popup feature, and get your key repetition back, simply issue the following command in Terminal:

defaults write -g ApplePressAndHoldEnabled -bool false

Now you can hold down any key and get a repeat. Yessssssssss!

Make Your Mac More Secure

Now, we’re going to spend a little time with Terminal commands to make your Mac just a bit more secure and private. Feel free to follow along at home.


Erase Free Hard Drive Space Securely
Even the NSA won't be able to see what's in your free space. Hopefully.
Even the NSA won’t be able to see what’s in your free space. Hopefully.

When you delete files from your Mac’s hard drive, they don’t actually go anywhere. What gets deleted is your Mac’s ability to use them in any functional way. When new files are put on the Mac, they might (or might not) overwrite some or all of the older, already-trashed files. To keep your files private, you might want to securely delete files from the Trash, and you might also want to delete all the files from the free space on your Mac.

To do so, simply type or paste the following command into Terminal:

diskutil secureErase freespace 3/Volumes/hard-drive-name

Replace “hard-drive-name” with the actual name of your hard drive, and then hit enter. You’ll get a progress bar, and if you have a big drive, it will take some time, as it overwrites each sector 35 times, five times as much as the US Department of Defense recommends, so you can assume it’s safely removed. This will get rid of any lingering files that you’ve already thrown away on your Mac, but didn’t do so securely.

Reset Privacy Data On Your Mac
Less sharing = more privacy.
Less sharing = more privacy.

We all add new apps all the time, and in our socially-networked world, it’s hard not to jsut give the apps the permissions they need to run, and then move on. Sometimes, though, you might want to just revoke all app access to your private data and start over from scratch. In OS X 10.8 Mountain Lion, you can use Terminal to do just that. You’ll be revoking access to specific data services for all apps, one data service at a time. So, to revoke access to the Address Book, for example, you’ll want to enter the following command into Terminal:

tccutil reset AddressBook

This should revoke all access to Contacts data from your Address Book. For something like your Location Data, enter the following:

tccutil reset CoreLocationAgent

You can get a full list of these types of services by typing

launchctl list

into Terminal. There is, of course, a Privacy preference pane in the System Preferences app, but this is a bit more direct. And geeky, too!

Reschedule Time Machine Backups
Seriously, every FIVE minutes? That's a bit intense.
Seriously, every FIVE minutes? That’s a bit intense.

A core feature of any data security plan is the backup system you use. Mac OS X’s Time Machine backups are fantastic and automatic, making sure your stuff is backed up on the fly, every hour. If you want to change the interval at which it backs your stuff up, however, you can do that via Terminal. Simply enter the following command into your Terminal app.

sudo defaults write/System/Library/LaunchDaemons/ StartInterval -int 1800

You’ll need to enter your admin password here as you’re invoking the Super User command, sudo. The 1800 there at the end will change your Time Machine backups to every 30 minutes, as it is an interval of seconds. To change it to back up every 15 minutes, use 900 in that spot. If you want to change it back to every hour, simply replace the 1800 in the above command to 3600.

Hack The Dashboard

Now, let’s look at the Dashboard with its widgets and things and see what we can do to hack it a bit.


Put Your Dashboard Widgets On The Desktop
Maybe I'll use the calculator a bit more, now?
Maybe I’ll use the calculator a bit more, now?

Honestly, I don’t use the Dashboard too much, as their functionality is limited, and it’s just faster to open a dedicated app that I can switch to with Command-Tab. However, maybe if I was able to drop them on the Desktop, I’d end up using a few of the more useful ones more often. It’s worth a shot, right?

All you need to do to make this happen is type or paste the following command into the Terminal app:

defaults write devmode YES

Then enter the following command, as well.

killall Dock

Once that’s done, launch Dashboard with F12 (or whatever other keyboard shortcut you have defined for the Dashboard), and find the widget you want out of there. Click and hold on it, move it a bit, and then hit F12 again to dismiss the Dashboard. The widget should then appear above whatever app you’re in, and stay in the foreground.

To get rid of the widget from the Desktop, and put it back in the Dashboard, do the same thing in reverse. Click and hold on the widget, hit the F12 key to bring up the Dashboard, move the widget around a bit, and then release the mouse button. Boom. Widget replaced.

Get Rid Of Dashboard Altogether

Screen Shot 2013-02-06 at 11.31.34 AM

Maybe you don’t like the Dashboard, have RAM issues, or otherwise want to just kill it completely. That’s not horribly difficult; just use the Terminal.

Type or paste the following command into the Terminal app, then hit Enter.

defaults write mcx-disabled -boolean YES

Then, go ahead and restart the Dock again, with the following:

killall Dock

Now you’ll have no more Dashboard. So sad, see ya later. If you want to bring it back, of course, there’s a simple command to bring it back, replacing the YES above with a NO:

defaults write mcx-disabled -boolean NO

Then killall Dock and you’re good to go.

Make Unsupported Features Work Again

Ok, so let’s take a look at a few of the newer features of the OS X world, and how to make them work on older, unsupported Macs using some Terminal magic.

Enable AirDrop Over Ethernet
You can do it!
You can do it!

AirDrop is one of those newer features, introduced in OS X Mountain Lion, that lets you share files to other supported AirDrop Macs on the same WiFi network as yours. Other folks can do the same thing to your Mac, as well. Unfortunately, AirDrop doesn’t work on older Macs, nor over Ethernet, by default.

If you’d like to try to make it work on your older Mac, simply past or type the following into your Terminal app:

defaults write BrowseAllInterfaces -bool true

Then, log out of your Mac and log back in to check and see if it worked.

Now, AirDrop should work on your older, unsupported Mac as well as over Ethernet. If you ever want to turn this ability off for any reason, simply replace ‘true’ in the command above with ‘false.’

Enable Time Machine For Unsupported Network Volumes
I wish I had a real time machine.
I wish I had a real time machine.

Time Machine rocks, mainly because it backs stuff up on our Macs without us having to do much of anything to make it regular and consistent. One issue, hoever, with Time Machine is that it only works with supported drives on the network. like Apple’s own Airport Extreme with Time Machine. What if you have a network-attached storage device that you want to back your data up to? These drives tend to be a lot less expensive per storage unit than anything Apple sells, but they aren’t directly supported by Mac OS X.

To make it so you can see these unsupported drives within the Time Machine system, all you need to do is launch Terminal and then issue the following command:

defaults write TMShowUnsupportedNetworkVolumes 1

This tweak isn’t officially supported by Apple, and as such won’t have any guarantee of working as well as an Apple solution. However, if you’re willing to risk it, this might be a great thing to try.