commandline

Latest

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

    by 
    Cory Bohon
    Cory Bohon
    06.23.2008

    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 canFind 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 goodnessIf 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 downIf 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.

  • Freeware Find: IceClean 3.0b

    by 
    Steve Sande
    Steve Sande
    06.05.2008

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

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

    by 
    Erica Sadun
    Erica Sadun
    01.16.2008

    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.

  • Yet even MORE evidence of upcoming iTunes rentals

    by 
    Erica Sadun
    Erica Sadun
    11.21.2007

    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 generalA 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

  • Grab Clean Leopard Window Shots with CleanGrab

    by 
    Erica Sadun
    Erica Sadun
    11.07.2007

    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.

  • Play Audio URLs from the iPhone Command Line

    by 
    Erica Sadun
    Erica Sadun
    08.17.2007

    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.

  • Open man pages from Xcode

    by 
    Mike Schramm
    Mike Schramm
    07.30.2007

    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.

  • Terminal Tip: Interactive Command-line File Encryption

    by 
    Erica Sadun
    Erica Sadun
    05.22.2007

    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.

  • Terminal Tip: Output man pages as plain text with col

    by 
    Erica Sadun
    Erica Sadun
    04.19.2007

    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.

  • Sudos and sudon'ts

    by 
    Erica Sadun
    Erica Sadun
    03.21.2007

    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.

  • 15 Nifty command line tricks to set various options

    by 
    Erica Sadun
    Erica Sadun
    03.20.2007

    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.

  • Monday man page: curl

    by 
    Michael Rose
    Michael Rose
    03.05.2007

    Today's man page covers one of my favorite utilities: curl. No, it's not a haircare product -- it's one of the most flexible download tools in the kit bag, with the ability to handle almost any protocol that can be addressed via a URL (hence the name, short for "client for URLs"). If there's a server out there that's reachable via HTTP, HTTPS, FTP, SFTP, SCP, and lots of other alphabet soup, curl can talk to it. curl http://www.tuaw.com/2007/03/05/monday-man-page-curl/ -- display the source of this very article in Terminal curl ftp://ftp.panic.com -- list the contents of a remote FTP site, in this case one with a pretty good FTP client curl -o ~/Desktop/curl-man.html http://curl.haxx.se/docs/manpage.html -- copy the curl manpage to your desktop; if you use capital -O, the local file mirrors the remote filename curl has an excellent usage manual at its site, detailing examples of use and advanced techniques. While there are zillions of ways to use curl in site testing, analysis and uploading, my favorite way of using it is as a quick file downloader. Read on for the details.

  • Monday man page: open

    by 
    Michael Rose
    Michael Rose
    02.12.2007

    Just a quick hint for today's man page: the open command does just what you might think. It opens files, directories, applications or URLs; no muss, no fuss. For files, you can specify an application to open them with the -a flag (or just trust LaunchServices to pick the right app). If you want to, the -e flag will force them to open in TextEdit. open ~/Desktop/MyWordDoc.doc [will open in MS Word] open -e ~/Desktop/MyWordDoc.doc [will open in TextEdit] open ~/Desktop/*.doc [opens every Word document on the desktop, in Word] open http://tuaw.com [well, give it a go!] I use open in installation scripts or other situations where I want a GUI application to come up at the end of a process. For example, open /System/Library/CoreServices/Software\ Update.app/ launches Software Update and begins checking for available patches. Sure, you can force an update with 'softwareupdate -i -a' anytime, but maybe I want to give the person sitting at the console an opportunity to select the updates needed, or cancel out of the possibly-lengthy update cycle until it's more convenient. You could also use the URL functionality to take people to a 'readme' website... the possibilities are manifold.

  • The "Lost" prompt

    by 
    Erica Sadun
    Erica Sadun
    12.07.2006

    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.

  • Spotlight from the Command Line

    by 
    Erica Sadun
    Erica Sadun
    11.28.2006

    0xFE (pronounced "254" I suppose...) has a very nice how-to up showing how to use Spotlight metadata to find files from the command line. The post shows how the mdfind command goes beyond find, locate and various grep hacks to create flexible and powerful queries. Surprisingly enough, I couldn't find an mdfind man page (mdutil was there) but the mdfind command worked fine for me in Terminal. A typical mdfind command goes something like mdfind Sadun, where Sadun is the search word. To limit the search to a particular folder use the -only flag. mdfind -only ~/Desktop Sadun. The mdls command displays the metadata associated with a specified file. e.g. % mdls Television\ copy.jpg Television copy.jpg ------------- kMDItemAttributeChangeDate = 2006-11-29 11:10:52 -0700 kMDItemBitsPerSample = 32 kMDItemColorSpace = "RGB" kMDItemContentCreationDate = 2006-11-29 11:10:19 -0700 kMDItemContentModificationDate = 2006-11-29 11:10:19 -0700 kMDItemContentType = "public.jpeg" kMDItemContentTypeTree = ("public.jpeg", "public.image", "public.data", "public.item", "public.content") kMDItemCreator = "Adobe Photoshop CS2 Macintosh" kMDItemDisplayName = "Television copy.jpg" kMDItemFSContentChangeDate = 2006-11-29 11:10:19 -0700 kMDItemFSCreationDate = 2006-11-29 11:10:19 -0700 (...and so forth...) It's a great post that goes into far more detail and is well worth a careful read.

  • Disk Order - an advanced Finder replacement

    by 
    David Chartier
    David Chartier
    06.01.2006

    Disk Order is another app that takes a stab at replacing the Finder, but doesn't seem to take things quite as overboard as PathFinder. With tabbed file browser windows, built-in FTP client, command line tools and more, Disk Order should have a few things to offer anyone who feels like the Finder is the ugly duckling of Mac OS X.A full-featured demo of Disk Order is available, while a license costs $22.57.[via MacMerc]

  • Switch iTMS countries via the command line

    by 
    Scott McNulty
    Scott McNulty
    04.13.2006

    I think we can file this one under 'Just because I can.' Erica Sadun has written a perl script that allows you to change your currently selected country in the iTunes Music Store. Both iTunes and Safari have to be open for this script to function.If you aren't a Terminal jockey you can just pop open the iTunes Music Store and choose your country from the pop up menu at the bottom of the main page, but who likes using GUI's anymore?