Not anything new, but today it helped (ok, at least seemed to help, I'm lacking my empirical data matrix) un-hang a beachballed Safari.
All you have to do is launch Activity Monitor (which just runs the "top" command, like in the Terminal) and it seems to unhang, unfreeze, unbeachball a stuck app.
Does it really work? I dunno. It seems to. It just did. Or at least seemed to. But is it falsifiable?
Showing posts with label terminal. Show all posts
Showing posts with label terminal. Show all posts
Thursday, March 3, 2011
Thursday, January 27, 2011
Burn VIDEO_TS folders as UDF discs via the Terminal
Usually you use DVD Studio Pro to burn a VIDEO_TS folder to discs, but if you find yourself on a computer that doesn't have that installed what can you do? Burning a VIDEO_TS folder via the Finder will result in a Mac OS Extended disc that won't be compatible with some stand-alone DVD players and won't play in DVD Player app. Same goes for Disk Utility. The Finder and Disk Utility will burn a Mac OS Extended rather than a UDF disc which is what many DVD Players (and DVD Player app) expect.
The solution is to use the Terminal. Yup.
00) Pop in a blank DVD.
01) Get your VIDEO_TS folder how you want it.
02) Fire up the Terminal.
03) Paste this:
hdiutil makehybrid -udf -udf-volume-name DVD_NAME -o MY_DVD.iso /path/to/VIDEO_TS/parent/folder
(that's all one line, btw)
Technically you're only going to paste this:
hdiutil makehybrid -udf -udf-volume-name DVD_NAME -o MY_DVD.iso
04) Hit spacebar
05) Drag in the folder that's enclosing the VIDEO_TS folder into the Terminal. You'll see it fill in that folder's path. Read step 5 again, it's important.
It's best to drag folders into the Terminal to get their path's correct as spaces in folder names make things tricky. If you want the path of a folder you can use Get Info or in the Finder hit Shift + Command + G for "Go to Folder..." and drag the folder into the text entry box. Be aware however that spaces will not appear as they should in the Terminal.
A better way to get the exact path (other than dragging the folder into the Terminal after you've pasted in the command) is to drag it into the Terminal before you've pasted in the command and see what the Terminal says. You can even copy/paste from here. Dragging it in after you paste in the command saves time though.
An example:
Lets say we have a folder called "untitled folder 3" we want to put into the command via it's path. Well, that folder has two spaces so in the Terminal, when we drag it there, we'll see:
/Users/HOMEFOLDER/Desktop/untitled\ folder\ 3
HOMEFOLDER will be whatever you've named your home folder in this case.
But, see how "untitled folder 3" is parsed in the Terminal?
untitled\(space)folder\(space)3
A space = \(space) in the Terminal. (space) is a space, like hitting the spacebar key on your keyboard.
So...let's say we have a VIDEO_TS folder inside a folder called "To Be Burned Off" on our Desktop. What would the path be?
/Users/HOMEFOLDER/Desktop/To\ Be\ Burned\ Off/VIDEO_TS
See, it's not that complicated once you understand how spaces work.
The command would then look like this:
hdiutil makehybrid -udf -udf-volume-name DVD_NAME -o MY_DVD.iso /Users/HOMEFOLDER/Desktop/To\ Be\ Burned\ Off
(again, that's all one line in the Terminal, there is a space between the .iso and /Users)
Ah ha...notice that we DO NOT point it directly to the VIDEO_TS folder. That's important. Point it to the folder ENCLOSING the VIDEO_TS folder.
You can change "DVD_NAME" and "MY_DVD" to whatever you like but make sure you follow proper DVD naming conventions or things will explode. DVD_NAME will be the name of the disc so the client will be able to see it so be careful. MY_DVD will be the name of the .iso and won't be on the burned DVD.
04) Hit return.
You'll find, after a time and a lot of periods in the Terminal, a disc image called MY DVD.iso likely at the root level of your Home Folder. This .iso will be UDF. Yay!
Now you'll need to burn this .iso disc image to a disc with Disk Utility.
05) Launch Disk Utility.
07) Hit Command + B (for "Burn...) or tap the Burn button.
08) Select the .iso you just made and hit the Burn button.
09) TEST THE DISC!
Your milage will vary on this tip mainly due to all the different versions of hdiutil, OS and Terminal that have been floating around.
NOTE: an alternate command if the above fails is this:
hdiutil makehybrid -iso -joliet -udf -udf-version 1.02 \
-default-volume-name "DVD_VIDEO" \
-o "/path/to/my/outputfile.iso" "/path/to/disks/content_folder";
(all one line)
hdiutil is very powerful and has myriad options. I urge you to flip though it's man page here.
You can also use this method to make Hybrid DVDs which hold not only DVD Video but Data Files as well. Place your DVD-ROM folder in the same folder that's enclosing the VIDEO_TS folder and use the Terminal command as is.
Oh, it wouldn't be a bad idea to also include an empty AUDIO_TS folder to help with compatibility of older stand-alone DVD Players.
Labels:
disc burning,
dvd studio pro,
hybrid disc,
terminal,
VIDEO_TS
Wednesday, September 8, 2010
How to Copy your own discs made in a Sony DVD recorder
I'm not sure what Sony is thinking here but if you burn a DVD using one of their DVD Recorders and then pop it into your Mac you'll see the contents are shown as empty despite it playing in DVD Player.app.
It's not empty. There really is a VIDEO_TS folder in there, only Sony doesn't want you to see it. I'm not sure what they've done to make it invisible since it'll still be invisible even if you show hidden files in the Finder (still gotta figure that one out, see below). Sure it'll show up on some Windows and Ubuntu boxes but not on Snow Leopard. Lets see if we can just change the permissions to access the VIDEO_TS folder...
It's not empty. There really is a VIDEO_TS folder in there, only Sony doesn't want you to see it. I'm not sure what they've done to make it invisible since it'll still be invisible even if you show hidden files in the Finder (still gotta figure that one out, see below). Sure it'll show up on some Windows and Ubuntu boxes but not on Snow Leopard. Lets see if we can just change the permissions to access the VIDEO_TS folder...
Nope.
So how can you copy it?
Well, the usual methods work like Toast & Disk Utility although I had an issue with Disk Utility not ever "finishing" the disc. It just unmounted, never said it was done and the disc kept spinning in the drive forcing me to restart the Mac to get it to eject (Hey, holding the mouse button while the Mac boots still ejects stuff after all these years...go figure).
So, angry at Sony for hiding the VIDEO_TS folder from me even though the client who handed it to me OWNS the content on the disc (and couldn't have known about Sony's degage draconian attitude) I decided to find a way to get to the VIDEO_TS folder just to spite them in Snow Leopard. Here's what I did:
1. Pop the disc in. Open it in a Finder window.
2. Launch the Terminal.
3. Type cd (spacebar) and then click and hold on the icon at the top of the Finder window for the disc and after a beat drag it into the Terminal to set the path.
4. Hit Return while in the Terminal.
5. For fun type ls (for list) and see "ls: .: Permission denied" so force it to list the contents by typing "sudo ls" without the quotes and then enter your password and hit return.
6. Bang. VIDEO_TS is listed. Screw Sony.
7. Copy this to your Desktop with "sudo cp -R VIDEO_TS ~/Desktop" sans quotes and enter your password. If you want to copy to a place other than the desktop just put a space after VIDEO_TS and drag the window icon of the volume or folder you want to copy it to to the Terminal window. An example would be "sudo cp -R VIDEO_TS Volumes/volumename/foldername"
8. Toss the VIDEO_TS folder into Disk Utility or Toast and burn it as the client requested and screw Sony.
9. Feel free to change the permissions for the VIDEO_TS folder as you need from the Finder now.
About why the VIDEO_TS folder is invisible I suspect it has something to do with this:
Macintosh:SONY_DVD_RECORDER_VOLUME user$ sudo ls -al
total 8
d--x--x--- 3 4294967295 nogroup 88 Jan 2 2004 .
drwxrwxrwt@ 12 root admin 408 Sep 8 23:03 ..
dr-xr-xr-x 2 4294967295 nogroup 768 Jan 2 2004 VIDEO_TS
Macintosh:SONY_DVD_RECORDER_VOLUME user$
"sudo ls -al" forces the Terminal to show the permissions of the files in the directory and as you can see two files are assigned to "nogroup". I suspect this is what's helping to hide the folder although I'm not done investigating just yet.
UPDATE:
Another option is to just pop the disc into a box running Ubuntu and simply drag it to some volume to copy it. How can you not love that?
UPDATE:
Another option is to just pop the disc into a box running Ubuntu and simply drag it to some volume to copy it. How can you not love that?
Monday, February 1, 2010
How much room is left on that drive?

Sometimes you run out of room on your drives. There's no real quick way to find out how much room is left on a drive without spinning it up and looking or hitting Command+I on it.
However, if you fire up the Terminal and type in "df -h" (sans quotes) you'll see how much space is left (and used) on every mounted drive. Handy for when you need some temp storage space for large files.
Wednesday, December 30, 2009
Quickly find out what media an optical drive can burn
A few times I've been someplace editing and have no idea what kind of burner is in the Mac there. Being pro-Terminal mostly, I tend to fire up the terminal and type in "drutil info" and hit Return. You'll see something like this:

You can also use System Profiler (Hold Option when selecting the Apple menu and you'll see About this Mac turn into System Profiler...) or use something like Toast but launching the Terminal and tying a simple command is reliable and fast.

You can also use System Profiler (Hold Option when selecting the Apple menu and you'll see About this Mac turn into System Profiler...) or use something like Toast but launching the Terminal and tying a simple command is reliable and fast.
Wednesday, October 14, 2009
Tip to use older Firewire devices under Snow Leopard
Macosxhints.com has an interesting tip on replacing a newer ktext file with an older one to get some older firewire devices to mount/work under Snow Leopard.
I haven't had any firewire devices that fail to work under Snow Leopard but this is good to know if you run into the problem.
I haven't had any firewire devices that fail to work under Snow Leopard but this is good to know if you run into the problem.
Labels:
firewire,
snow leopard,
terminal,
troubleshooting
Tuesday, October 13, 2009
Motion 4: May be unable to open projects
Here's a handy tip if Motion 4 refuses to open a project for you after installing Snow Leopard and FCS 09:
The Knowledge Base article is here.
What's Touch do? From it's Man page:
To address this issue, be sure Motion is not running. Then, open Terminal (located in ~/Applications/Utilities), and run the following command:
sudo touch /Applications/Motion.app
The Knowledge Base article is here.
What's Touch do? From it's Man page:
The touch utility sets the modification and access times of files to the current time of day. If the file doesn't exist, it is created with default permissions.
Labels:
knowledge base,
motion,
snow leopard,
terminal,
troubleshooting
Friday, October 2, 2009
What Model Mac Are You On?
If you're troubleshooting a Mac and aren't sure what exact model it is...so you don't know what firmware this or that needs...there's an easy way to find out not only the model designation but the type of CPU as well.
Fire up the Terminal (From the Finder hit Command + Shift + U, then T, then Command + O) and type in:
sysctl -a hw
Then hit Return.
You'll see fun info like:
hw.activecpu: 2
hw.physicalcpu: 2
hw.physicalcpu_max: 2
hw.logicalcpu: 2
hw.logicalcpu_max: 2
hw.cputype: 7
hw.cpusubtype: 4
hw.cpu64bit_capable: 1
hw.availcpu = 2
hw.machine = i386
but most importantly:
hw.model = Macmini2,1
If you want to see the exact CPU type, type in:
sysctl -a
and hit Return then look for something like:
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz
Fire up the Terminal (From the Finder hit Command + Shift + U, then T, then Command + O) and type in:
sysctl -a hw
Then hit Return.
You'll see fun info like:
hw.activecpu: 2
hw.physicalcpu: 2
hw.physicalcpu_max: 2
hw.logicalcpu: 2
hw.logicalcpu_max: 2
hw.cputype: 7
hw.cpusubtype: 4
hw.cpu64bit_capable: 1
hw.availcpu = 2
hw.machine = i386
but most importantly:
hw.model = Macmini2,1
If you want to see the exact CPU type, type in:
sysctl -a
and hit Return then look for something like:
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz
Monday, June 8, 2009
Safari 4.0 how to turn off Top Sites and reclaim CPU cycles
Safari 4.0 is out and it steals a lot of CPU if you're not careful. There's a process called Safari Webpage Preview Fetcher which grabs sites for Safari to take screenshots of in the background for Top Sites.
The problem is this background process can eat up to 10% of your CPU when it's running or more. This isn't good when you need every ounce of power out of your Mac while you render or perform Multiclip edits in FCP.
Worse still, is there is a folder at ~/Library/Caches/com.apple.Safari/Webpage Previews which will fill up with .png and .jpeg screenshots of websites you visit (or don't visit but have bookmarked). Not only is this a security risk, (it'll take screenshots of your web email) but it's messy, can eat up a LOT of hard drive space and keeps backup software needlessly busy.
Here's how to stop all this from happening.
Keep in mind Safari 4.0 only came out a few hours ago so this "fix" hasn't been tested in the long term. I'm trying it right now and so far things seem okay. The only caveat seems to be some sites never finish "loading" because they never have a screenshot taken of them. They do complete loading but you'll see spinning gears on some of their tabs.
1. Quit Safari 4.0 and right-click on it's icon in the Finder. Select "Show Package Contents".
2. Look inside the Contents folder and right-click on Safari Webpage Preview Fetcher and select Compress "Safari Webpage Preview Fetcher".
3. Put the original Safari Webpage Preview Fetcher in the trash and empty it.
4. Navigate to ~/Library/Caches/com.apple.Safari/Webpage Previews and highlight it. Get Info on it.
5. At the bottom click on the padlock, type in your password and then change the Privilege column for your login name to "Read only". Close the Get Info window.
6. Launch Safari.
Btw, a great way to stop ad sites is to set up and use OpenDNS. Also, if you dislike seeing ads in Safari you can install and try either of these: GlimmerBlocker or Safari AdBlock.
An alternate method has been emailed to me which I have not tried so use it at your own risk:
I can confirm that the following list of terminal commands works fine:
cd ~/Library/Caches/com.apple.Safari/
rm -rf "Webpage Previews"
ln -s /dev/null "Webpage Previews"
The only issue is that there is an error logged in the console for each website visited.
I haven't tried this as my method seems to be working so far. I think this is from the discussion forums at Apple. Unfortunately I can't credit the original poster as I'm not sure who it is.
UPDATE: Quit Safari toss this into the Terminal to effectively turn off Webpage Previews:
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
Then relaunch Safari.
To return to Safari generating Webpage Previews quit Safari then throw this into the Terminal:
defaults delete com.apple.Safari DebugSnapshotsUpdatePolicy
The problem is this background process can eat up to 10% of your CPU when it's running or more. This isn't good when you need every ounce of power out of your Mac while you render or perform Multiclip edits in FCP.
Worse still, is there is a folder at ~/Library/Caches/com.apple.Safari/Webpage Previews which will fill up with .png and .jpeg screenshots of websites you visit (or don't visit but have bookmarked). Not only is this a security risk, (it'll take screenshots of your web email) but it's messy, can eat up a LOT of hard drive space and keeps backup software needlessly busy.
Here's how to stop all this from happening.
Keep in mind Safari 4.0 only came out a few hours ago so this "fix" hasn't been tested in the long term. I'm trying it right now and so far things seem okay. The only caveat seems to be some sites never finish "loading" because they never have a screenshot taken of them. They do complete loading but you'll see spinning gears on some of their tabs.
1. Quit Safari 4.0 and right-click on it's icon in the Finder. Select "Show Package Contents".
2. Look inside the Contents folder and right-click on Safari Webpage Preview Fetcher and select Compress "Safari Webpage Preview Fetcher".
3. Put the original Safari Webpage Preview Fetcher in the trash and empty it.
4. Navigate to ~/Library/Caches/com.apple.Safari/Webpage Previews and highlight it. Get Info on it.
5. At the bottom click on the padlock, type in your password and then change the Privilege column for your login name to "Read only". Close the Get Info window.
6. Launch Safari.
Btw, a great way to stop ad sites is to set up and use OpenDNS. Also, if you dislike seeing ads in Safari you can install and try either of these: GlimmerBlocker or Safari AdBlock.
An alternate method has been emailed to me which I have not tried so use it at your own risk:
I can confirm that the following list of terminal commands works fine:
cd ~/Library/Caches/com.apple.Safari/
rm -rf "Webpage Previews"
ln -s /dev/null "Webpage Previews"
The only issue is that there is an error logged in the console for each website visited.
I haven't tried this as my method seems to be working so far. I think this is from the discussion forums at Apple. Unfortunately I can't credit the original poster as I'm not sure who it is.
UPDATE: Quit Safari toss this into the Terminal to effectively turn off Webpage Previews:
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
Then relaunch Safari.
To return to Safari generating Webpage Previews quit Safari then throw this into the Terminal:
defaults delete com.apple.Safari DebugSnapshotsUpdatePolicy
Wednesday, May 20, 2009
Disk is in Use and You Can't Eject It
Ever had a hard drive you can't eject because the Finder claims it's in use even though no project is open on it, no file is open, no anything is anything on the drive?
Usually the culprit is FCP which sometimes doesn't want to be left all alone and desperately clings to any last vestiges of its former usefulness. There's a Terminal command to find out what is using the drive (or at least what file is open on it) but it's the Terminal and that's not very Mac-Like.
So, recently a free application called WhatsOpen appeared and it's perfect for finding out what's going on. Give it a try and donate something if you like it and find it useful.
This is different from when the Finder just decides to leave a properly ejected drive's icon in the sidebar which does happen on occasion. Those you can just drag out of the sidebar and enjoy the poof of smoke.
If you really want to know the Terminal command it's:
lsof | grep /Volumes/Stubborn-Hard-Drive
Where Volumes/Stubborn-Hard-Drive is the path to the hard drive in question. To make it a little easier just type:
lsof | grep
into the Terminal, then drag in the stubborn hard drive from the Finder and hit return. You'll see what file is "in use" on the drive. lsof, btw means LiSt Open Files.
Usually the culprit is FCP which sometimes doesn't want to be left all alone and desperately clings to any last vestiges of its former usefulness. There's a Terminal command to find out what is using the drive (or at least what file is open on it) but it's the Terminal and that's not very Mac-Like.
So, recently a free application called WhatsOpen appeared and it's perfect for finding out what's going on. Give it a try and donate something if you like it and find it useful.
This is different from when the Finder just decides to leave a properly ejected drive's icon in the sidebar which does happen on occasion. Those you can just drag out of the sidebar and enjoy the poof of smoke.
If you really want to know the Terminal command it's:
lsof | grep /Volumes/Stubborn-Hard-Drive
Where Volumes/Stubborn-Hard-Drive is the path to the hard drive in question. To make it a little easier just type:
lsof | grep
into the Terminal, then drag in the stubborn hard drive from the Finder and hit return. You'll see what file is "in use" on the drive. lsof, btw means LiSt Open Files.
Labels:
bug,
eject,
finder,
handy software,
hard drives,
terminal,
tips
Tuesday, December 2, 2008
Comparing Files

Sometimes we end up with two different versions of a video or file and dont' know if they are, in fact, different. Or, sometimes when we hand off a disc to a client they claim they can't view the video or it's "corrupted". So, here's how to compare files a simple, straight forward and built-into the Mac way.
Method #1 "MD5".
01 Launch the Terminal. (I like to hit Command + Shift + U to open the Application folder, then hit the letter T and up and down arrow from there, then hit Command + O or use Control + F3 if the terminal is already in the dock)
02 OPTIONAL STEP: Hit Command + COMMA to open the Terminal's Preferences and goto Settings > Window > Background Color. In the color window that opens set the transparency to something like 60%. Close the preferences.
03 In the Terminal type exactly, without the quotes "md5" in lowercase.
04 Hit Spacebar.
05 Drag the first of the files you want to directly compare into the terminal window. You'll end up with something like:
md5 /Volumes/HD01/Video/Files/Movies/movie01.mov
06 Hit Return.
After a moment (bigger files take longer) you'll see a number appear as a result. Something like: aa3f30d5e8977965702c4acc83f645da
Now, do the exact same thing with the file you want to compare this first file with. But why did you mess with the preferences to alter the transparency of the window? A quick trick to compare the numbers, since they're so long, is to run md5 in two separate Terminal windows, and since they're transparent -or at least translucent-, overlap them and see if the images of the generated numbers match.
If the numbers are identical, the files are identical.
If you need to generate md5 sums on many files in one directory, from a fresh Terminal prompt, type "cd" then hit spacebar, drag the directory (folder) into the terminal window and hit Return to change it to that directory. Then type "md5 *" and hit enter (that's an asterisk after a space) and you'll see a list of md5 numbers.
Method #2 "CMP".
01 Launch the Terminal.
02 Type "cmp -l" (that's a lowercase letter L)
03 Drag the first file you want to compare into the window.
04 Drag the second file, the one you want to compare against the first, into the window. You'll end up with a long line of paths and directories to the two files.
05 Hit Return and wait a while. There is absolutely no indication that anything is happening while it compares them. If you return to the standard prompt, the two files were identical. If it outputs some sets of numbers the files are different. Be patient, it can take a while to compare large files.
"cmp" will compare the files byte-by-byte and let you know if they are different. The difference it will spew out won't make much sense to the average viewer, but the importance is that it'll let you know they are different.
Use both command-line tools to be even more sure of the files are the same or not.
Friday, June 27, 2008
Invalid Content In Journal
Macfixit.com has a small interesting bit on a specific error that fortunately you've never seen. It involves an unmountable hard drive and when it's journaling is kaput. it wont' mount, but there's apparently a handy dandy terminal command to fix it.
The thing is it's generally unwise to use journalling on your Capture drives, namely speed issues. But if you have a drive that suddenly won't mount and flip on Repair Disk and see the Invalid Content in Journal error here's the fix.
Essentially copy this into the terminal with the appropriate name for your problematic drive:
/System/Library/Filesystems/hfs.fs/hfs.util -N /dev/disk0s2
The -N flag disables journaling on the device. You can find the device's name in Disk Utility's Info window.
The thing is it's generally unwise to use journalling on your Capture drives, namely speed issues. But if you have a drive that suddenly won't mount and flip on Repair Disk and see the Invalid Content in Journal error here's the fix.
Essentially copy this into the terminal with the appropriate name for your problematic drive:
/System/Library/Filesystems/hfs.fs/hfs.util -N /dev/disk0s2
The -N flag disables journaling on the device. You can find the device's name in Disk Utility's Info window.
Labels:
hard drives,
mounting,
terminal,
troubleshooting
Tuesday, June 17, 2008
Can't Eject A Volume Because it's in Use? Use lsof.
macosxhints has a really handy bit of terminal magic to find out just what's in use when you can't eject a volume.
Thursday, October 4, 2007
QuickTime Pro Export Bug
Apparently QuickTime Pro has a bug where when you export with it it may leave lots of little (and by little I mean huge) temp files scattered all over your HD like bras during Mardi Gras.
You can read about the bug here and how to eliminate the temp files which involves the terminal which mean someone will write a free app and put it on Macupdate right about 8mins ago.
If you do a lot of exporting from QuickTime Pro -- even the latest versions -- you might want to check your system for a large number of hidden temporary files that didn't get erased. This problem shows up even if your QuickTime Pro export is successful.
You can read about the bug here and how to eliminate the temp files which involves the terminal which mean someone will write a free app and put it on Macupdate right about 8mins ago.
Subscribe to:
Posts (Atom)

