Skip to Content

Submit your nominations for the Luxist Awards' Best in Decor
AOL Tech

commandline posts

Filed under: Developer, Snow Leopard

Mac 10.6 comes with license to kill

The name's Leopard... Snow Leopard... and how I wish it was 10.7 instead of 10.6 so I could extend these hokey James Bond allusions further. That said, it is closer than the truth than you may think. Apple has given Snow Leopard a license to kill... but this doesn't have anything to do with espionage or even spyware (pardon the pun). Instead, it has everything to do with Apple's desire to make the shutdown process faster.

One of the systemwide refinements tells us that "Snow Leopard is up to 80 percent faster when shutting down." If you've ever waited impatiently for your Mac notebook to shut down while your flight was boarding or at the end of the day when you are anxious to get home, Apple is looking to reduce that frustration.

Towards that end, Snow Leopard allows developers to mark their applications as "clean" or "dirty" -- not that kind of dirty!

Here's an example of what "clean" vs "dirty" means in this context: imagine you have been working in Pages, but all of your documents are saved (or maybe you've closed all the documents but Pages is still running). Pages can mark itself "clean" which is similar to saying "I'm ready when you are!"

Now imagine that you are working in Pages, and you've saved your file, but after you saved it you made some additional changes. Perhaps you have several documents open and unsaved, or you've got a Preferences dialog open. If you look at the 3 circles in the top-left corner of the window, you'll see that the one of the far left has a hole in the middle which goes away when you save the file. If any of those situations are true, Pages is considered "dirty," the programmatic equivalent of "Just a moment please!"

When the user tells the operating system to shutdown (not just sleep), the operating system will look to see which applications are "ready to go" and applications are still looking for their metaphorical keys. The ones that are ready? They get killed, and killed hard.

It's like the difference between telling an app to "Quit" versus "Force Quit." If you ask it to Quit, it is going to check to see if it needs to do anything before it does. If you tell it to Force Quit, it's just going to go away.

If you are familiar with the Terminal, you may have used 'kill' to stop some process from running. Usually if you want to 'kill' an application nicely, you send 'kill -TERM' ("software termination signal") which says "OK, clean up your things and let's go!" However if you find that something refuses to stop, you might use 'kill -9' which is referred to as SIGKILL, described as "non-catchable" and "non-ignorable." This is like picking up your child and carrying him or her away because it is time to go now with no questions asked. Applications which mark themselves as "clean" are telling the operating system: "You can use 'kill -9'/Force Quit on me without worrying about losing anything."

How much longer does "Quit" take compared to "Force Quit"? Maybe only a second or two, maybe a fraction of a second. But if you have a lot of applications running and the majority of them can skip that time, it helps the overall speed of the shutdown. Think of it like this: imagine you had a bunch of family members over and you were trying to get everyone out of the house to go to a restaurant: young kids, a couple of older aunts and uncles, and maybe grampa. You've probably asked something like this: "Does everyone have everything they need? Kids, did you go to the bathroom? Uncle Joe, did you get your coat and hat? Grampa, do you have your sweater in case it's too cold?" Even if everyone says "yes" it took longer than if you said "Let's go" and everyone replied "We're all ready!"

Is this a "sexy" feature of our newest cat-themed operating system? Not at all, but it is one of those "little details" that makes life a little easier as a Mac user: a little faster, a little more attention to detail, and exactly the sort of thing Apple promised to pay attention to with Snow Leopard.

(Big tip o' the hat to John Siracusa's epic Snow Leopard review at Ars Technica for bringing my attention to this feature. I look forward to John's operating system reviews almost as much as I look forward to the operating systems themselves.)

photo via flickr creative commons: danzen

Filed under: iPod Family, iPhone

3.0 firmware release expected at 10am PT/1pm ET, quick Terminal tip to check

Hey, iPhone 3G owners: Please do not download the 2,1 firmware files listed below. They are for the 3G S and will not work on your phone. Read the whole post for details. The correct firmware for the 3G will start with "iPhone1,2" instead.

If you were up all night waiting for the new iPhone OS to arrive, you're in good company -- we were too, until we began getting Twitter reports from users in Hong Kong and Sweden that the local carriers sent out SMS alerts to their customers suggesting when they could download 3.0. Those times both align with a 10 am PT/1 pm ET go time, and that's when we're calling it for now; Engadget concurs. That's why you're still seeing 2.2.1 as the most current version in iTunes; the new version hasn't been released yet.

Those with a command-line bent and an inability to wait without doing something can launch Terminal and type in the following every few minutes to see whether 3.0 has launched, rather than repeatedly clicking the Check for Upgrade button in iTunes (note that the up-arrow in Terminal reloads the previous command):

curl -s -L http://phobos.apple.com/version |\
grep -i restore |\
grep '_3.' | open -f

The results will look something like URLs ending with this:

iPhone2,1_3.0_7A341_Restore.ipsw
iPhone2,1_3.0_7A341_Restore.ipsw

The model number indicates which unit has downloadable firmware. As of right now, only the iPhone 3G S firmware has been updated. That's the 2,1 iPhone model. Yes, the 1,2 iPhone 3G model was considered a revision of the first generation 1,1 iPhone as it only had moderate hardware changes. The two iPods are 1,1 and 2,1 for the first and second generation.

(No, for those wondering in the comments, you cannot download the 2,1 firmware and install it on your iPhone or iPhone 3G -- it will only work with the 3G S.)

To download, copy the URL and paste it into Safari's download window or use any other favorite method to retrieve the firmware. Then hold the Option key and click Update in iTunes. Navigate to the firmware (the ipsw file), select it, and 3.0's good to go. Of course, you can also download directly through iTunes as soon as the update is available.

Filed under: iPod Family, Cool tools, Hacks, iPhone

LiveChat: Pwnage and Beyond

This weekend, the iPhone Dev Team delivered an iPhone 2.0 jailbreak. Today, TUAW invites you to chat about the jailbreak, about the new Cydia installer, and about the future of iPhone jailbreak development and use. Follow the jump to join in our discussion.

Continue readingLiveChat: Pwnage and Beyond

Filed under: Mac 101

Mac 101: Get that "stuck" disc out of your Mac

Welcome to another Mac 101 here at TUAW. Mac 101 is our recurring feature where we point out some tips and tricks for folks new to the Mac. Remember, if you're a Mac expert this post isn't for you.

Have you ever tried to unmount a disc in Mac OS X, but it simply wouldn't come out of your Mac's drive? Here are three ways of removing discs from your Mac's drive. If your Mac is currently using the disc you won't be able to eject it, so make sure that isn't the case first. If the disc isn't in use and you still can't eject it, give these a try.

Step 1: Drag the disc to the trash can
Find the disc on the desktop and drag its icon to the Mac OS X trash can. As you start dragging it towards the trash, the icon will change to an eject button, release the mouse button when the disc's icon is directly over the eject button.

Step 2: Try some command line goodness
If you have tried to eject the disc by dragging its icon over the trash bin, then why not try a simple Terminal command to eject the disc. Open Terminal.app (found in /Applications/Utilities/Terminal.app; or use Command + Shift + U to in any Finder window to move to the Utilities folder).

Once you have Terminal opened, type (or copy/paste) the following command: drutil eject

Step 3: Restart your Mac while holding mouse button down
If you've tried the other steps to no avail, then why not reboot your Mac while holding down the mouse button. Upon loading the Apple boot screen, your disc should be ejected.

Please note that if you have a disc that is actually physically stuck in the drive, this will not help. Stuck discs may need the assistance of an Apple Genius or certified Apple repair professional.

Filed under: Software, Cool tools, Odds and ends, Freeware, Troubleshooting, Terminal Tips

Freeware Find: IceClean 3.0b

IceClean 3.0.6Most of us know that we should perform regular maintenance on our Macs, usually simple things such as doing backups and shaking pizza crumbs out of the keyboard. But did you know that there are a number of UNIX System Tasks that are available for keeping your Mac running at peak performance?

A lot of Mac users don't want to pull up Terminal and type arcane text into the command line, so MacDentro has a GUI front end that you can use to run those commands and keep your Mac cruisin'. IceClean, now at version 3.0.6 has menus for OS X Maintenance, Cleanup, Security and Network, and Utilities, all of which are packed with menu choices or keyboard shortcut equivalents that make mundane maintenance chores simple to perform.

There are other apps available -- Maintenance and MacJanitor come to mind -- that perform similar tasks, but neither of those programs comes close to the depth of capability of IceClean.

The price is right, too - it's free, although you might want to send the MacDentro folks a donation if you find yourself using IceClean regularly. Download IceClean here.

Tip of the hat to our very own Victor Agreda for this find!

Filed under: iPod Family, Hacks, How-tos, Terminal Tips, iPhone

Terminal Tip: Syncing your iPhone or iPod touch from the command line

This is one of those completely useless but cool things that one figures out when one is spending far too much time trying to do something else and not accomplishing it. In my case, I'm trying to figure out how to force an iPod touch or iPhone to load a backup set. (Do you know? Let me know in the comments!) What I accomplished though was figuring out how to sync the unit with a simple command-line utility. Here's how.

Launch System Profiler. Choose Apple > About This Mac > More Info.

Identify your iPod In System Profiler, go to Hardware > USB and locate the iPod or iPhone you're using. Look up the Manufacturer ID (0x05ac (Apple Computer, Inc.) and Product ID (0x1291 for my iPod touch)

Launch Terminal. This requires shell access.

Find the utility. Change directories to /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/.

Run reenumerate Give it one argument: the vendor id followed by a comma followed by the product id, e.g. ./reenumerate 0x05ac,0x1291

Wait. iTunes will reload your iPod or iPhone and sync it.

Filed under: iPod Family, iTS, iPhone

Yet even MORE evidence of upcoming iTunes rentals

Today's evidence comes to you courtesy of the Apple iPhone. iPhone Developer Pumpkin. He has discovered even more rental-specific information, this time in the iPhone's lockdown daemon file. Lockdown is responsible for authorizing your iPhone for services. For example the lockdown files are involved in authorizing phone service and is also responsible for communication between the device and the computer in general

A string search through the lockdownd executable in /usr/libexec produced the following hits when searched for "rental":

pumpkin:~ pumpkin$ strings /usr/local/share/iphone-filesystem/usr/libexec/lockdownd | grep -i rental
trigger_rental_bag_verification: Could not retrieve FairPlayID
trigger_rental_bag_verification: Could not initialize FairPlay context
trigger_rental_bag_verification: Could not verify the rental bag response: %d
load_rental_bag_request: Could not retrieve FairPlayID
load_rental_bag_request: Could not initialize FairPlay context
load_rental_bag_request: Could not generate rental bag request
load_rental_bag_request: Could not create mutable dictionary
load_rental_bag_request: Could not create CFData from request message
load_rental_bag_request: Could not create CFArray
load_rental_bag_request: Could not create CFNumber from indice
RentalBagResponse
RentalBagRequest
pumpkin:~ pumpkin$

As of last night, Apple still did not have a public rentalBag web objects interface the way it does for storeBag and secureBag, the two XML files it publishes on its Phobos server. Hopefully, once readers start occasionally pinging http://phobos.apple.com/rentalBag.xml.gz and http://phobos.apple.com/rentalBag.xml, you'll let us know via the Tip line if and when you see any life.

Thanks PlanetBeing

Filed under: How-tos, Leopard

Grab Clean Leopard Window Shots with CleanGrab


Ryan Irelan doesn't like the way Leopard grabs window shots. When you press Command-Shift-4/Spacebar, Leopard includes about 50 extra pixels of transparent background around your Windows. This extra space grabs the window's drop shadow along with the window itself. Enter CleanGrab.

CleanGrab is Ryan's script for grabbing just the window, without the background pixels. He describes the script and offers a download link on his personal weblog. You'll either need to run the script directly or trigger it via a macro program like Quicksilver. The script essentially runs the command-line screencapture software using the -io flags. -i tells screencapture to run interactively. -o tells it to omit the window shadow.

If you'd rather just use the terminal command-line, issue a screencapture -io command. I've posted about this handy utility a few times at least.

Filed under: Hacks, iPhone

Play Audio URLs from the iPhone Command Line

You never know when instant karma is gonna getcha. Take my playaudio application. Yesterday, I was chatting with some developer buddies about maybe putting together an Internet radio application and discussing the fact that the Celestial iPhone framework is essentially QuickTime repackaged. While talking, I decided to try using my existing playaudio app with a URL rather than a local audio file. So I typed the following at the iPhone command line:

playaudio http://steiner.math.nthu.edu.tw/ne01/tjy/music/06.I%20Just%20Called%20To%20Say%20I%20Love%20You.mp3

And...it worked. Just like that, the instrumental-only cover began to play back through my iPhone speakers. Apparently, Apple has merged the concept of "local file" and "URL" a lot more closely than I'd thought. I haven't had any luck connecting to .pls or any other live radio feed but if you'd like to play back Internet-based files, playaudio works just fine.

Filed under: Productivity, Tips and tricks, Odds and ends, Developer

Open man pages from Xcode

Toxic Software's posted a useful little script if you spend any amount of time in Xcode-- because manopen is having trouble with Leopard, John punched up a shell/Applescript to open man pages directly from within Xcode's command line. It's tiny (and doesn't really do much-- just opens an Xcode Help menu item), but it seems useful-- straight from the command line, you can break out the man page within a GUI, and just keep right on coding.

Because the script uses UI scripting, you've got to enable an option in Universal Access preferences, but then just toss the script in your PATH and you're good to go. I can't imagine it's hugely relevant for everyone out there (I haven't put anything together from the command line in Xcode in a while), but anyone building stuff there will probably appreciate it.

And if viewing pretty man pages from the command line is your thing, Atomicbird Software came up with a script that breaks out man pages in PDF form. If you love working from the command line but love reading man pages in something a little easier to browse, today's your lucky day.

Filed under: Tips and tricks, Terminal Tips, Security

Terminal Tip: Interactive Command-line File Encryption

In OS X, you can always toss a file onto the command line instead of laboriously typing out a complete path name because Terminal supports drag and drop. Over at Murphymac, Murphy has posted a video showing you how to create a shell script using DES3 encryption to protect your files. It takes advantage of this drag and drop support so you can basically run the script and drop the file you want to encrypt. Even if you're not all that interested in encrypting your files, this videocast shows how to think about creating shell scripts with a particularly interactive OS X flare flair.

Filed under: Tips and tricks, Terminal Tips

Terminal Tip: Output man pages as plain text with col

Ever try to open a man page in TextEdit using man | open -f? You end up with the kind of unreadable repeated characters shown here. This all dates back to the days of dot matrix and daisy wheel printing when the only way you could produce bold type was to repeatedly print characters. Fortunately, there's an easy way to convert man pages into simple, non-redundant text. Use the command-line utility col with the -b flag enabled. For example, man col | col -b | open -f will open the col man page in TextEdit without repeated characters. The -b flag tells col to exclude all but the last character written to any column, ignoring any backspaces and repeats.

Filed under: UNIX / BSD, Security

Sudos and sudon'ts

I find that I'm visiting RixStep on a regular basis these days. Today I stumbled across this post about using root privileges and thought I'd share it with you. If you want to learn more about using Mac admin privileges, this might not be the best post to start. If you already have some familiarity with the command line and with Unix, you can learn more about what su does, how to authenticate yourself, and understand why this affects security in a handy ten-point check list. It's a little verbose, but there's a lot of good meat in the article.

Filed under: Hacks, How-tos

15 Nifty command line tricks to set various options

UK website MacOSXTips has put together a list of 15 of their favorite command line preferences tricks. The tricks, which all use the defaults command, range from deactivating Dashboard, to showing hidden files in the Finder, to displaying all mail as plain text. I had a blast rediscovering some old preferences tricks and learning some new ones.

Filed under: How-tos

The "Lost" prompt

Blogger David Winter has a posted a cute how-to showing you how to change the prompt in your terminal to the ">:" used in Lost.

Basically, you update your .zprofile or .bashrc or .kshrc to include the line export PS1=">: ". Me? I'm a csh weenie. I'd have to use set prompt=">: " to get the same effect. (The same thing applies for tcsh users.)

Winter also includes instructions on how to get the green-on-black color settings used in the program.

4 8 15 16 23 42 and all that.

Tip of the Day

Reply in the Mail.app with a specific quote.
Select the text you want quoted and then hit the reply button.
Only your selected text will copied to the reply email.


Follow us on Twitter!
 TUAW [Cafepress]

Featured Galleries

DNC Macs
Macworld 2008 Keynote
Macworld 2008 Build-up
Google Earth for iPhone
Podcaster
Storyist 2.0
AT&T Navigator Road Test
Bento for iPhone 1.0
Scrabble for iPhone
Tom Bihn Checkpoint Flyer Briefcase
Apple Vanity Plates
Apple booth Macworld 07
WorldVoice Radio
Quickoffice for iPhone 1.1.1
Daylite 3.9 Review
DiscPainter
Mariner Calc for iPhone
2009CupertinoBus
Crash Bandicoot Nitro Kart 3D
MLB.com At Bat 2009
Macworld Expo 2007 show floor

 

More Apple Analysis

AOL Radio TUAW on Stitcher