Posts tagged with "mac os x"


Turning a Firefox story into an anti-Mac story?

This is another post that's been sitting in my Drafts folder since the 20th of June 2008. In trying to clean out this backlog I'm finishing and publishing these posts now, even if this particular story is somewhat outdated. Cheers ^_^

Robert Vamosi over at Defence in Depth has reported that Mozilla Firefox 3 has suffered a vulnerability since being released on the 19th of June.

Less than one day after its launch, Firefox 3 has a vulnerability.

According to Tipping Point's Zero Day Initiative, the vulnerability, which it rates as critical, was reported within the first five hours of Firefox 3's release.

Although the Zero Day Initiative team does not offer specifics until the vendor has a chance to patch it, the blog post did say this vulnerability, which also affects Firefox 2, requires user interaction and could result in an attacker executing arbitrary code.

There were the usual posts from people ignoring past trends and decrying that Internet Explorer is therefore obviously better, but by some miraculous feat of asserted association, Tbird1996 somehow managed to twist the story into a anti-Mac fanboy story.

..ok...it's better than anything that MS has to offer. Mac guys...sorry you're soooo insignificant...and when Linux get just a little further down the road...we'll all be better for it.
(why do the Mac people trash Linux so badly when their OS is based on Linux...?' eh?)

Firefox icon Don't get me wrong, I hate it when vocal Mac users loudly proclaim everyone else as stupid for not having Macs, but I do agree it's a superior platform for many uses. I also don't like it when generalisations are made, by people on either side of an argument. This was my response:

I'm a Mac user and I love Linux. Most Mac users I know acknowledge Linux as a positive force. Please don't whitewash entire groups of people.

Oh and for the record, Mac OS X is not based on Linux. Please check your facts before submitting such comments.

Though to be fair, I actually "love" FreeBSD and "like" GNU/Linux, but I suspect if he thought that they were the same in asserting that Mac OS X is based on them, he/she wouldn't know the difference.

For what it's worth, Mac OS X is based on NeXTSTEP and FreeBSD with a Mach kernel. Despite having a few GNU userland tools and common commands, Mac OS X and Linux have almost no code in common, and one is certainly not derived from another! The funny thing is a 30 second look on Wikipedia would show this.


Partially recovering damaged tar files in Mac OS X

Archive Utility having trouble with a malformed/damaged tar file
Archive Utility having trouble with a malformed/damaged tar file

Okay enough political nonsense, back to writing about technology and software!

Unlike zip or proprietary rar files, in true "do one thing and do it well" Unix style, most Unix-like file compressors (such as bzip2, rzip or gzip) only compress one file at a time. An intermediate container format is needed if multiple files in one compressed archive are needed, the most common of which is the Tape Archive file/tarball or tar.

Archive Utility Mac OS X's Archive Utility (which you invoke from the Finder) has native support for tar, but I'm surprised by the number of times I see the error message above after double clicking and attempting to open one. Usually this is a result of a malformed or broken tar file, but the nature of tar files is that generally some files can be salvaged. The Finder refuses to do this, which worries me. How many GUI proficient Mac users throw away tar files that they could salvage at least some files out of?

The solution is a quick trip to the Terminal and using the cd command (same way as DOS) to navigate to the folder where the tar file you're having trouble with is located. Then enter:

% tar xvf [FILENAME].tar

In a nutshell, xvf tells tar to verbosely display files as they're extracted. In this circumstance this is very useful!

You'll see a stream of filenames fill up your window, followed by a message similar to the following if you're tar file was corrupted.

[...]
tar: End of archive volume 1 reached
[FILENAME].tar: Unexpected EOF on archive file

While you some of your files may have been extracted, clearly in this case you've received a poorly formed tar file. If possible, you should attempt to download it again from where you got it, or if you made it yourself try to find a backup.


Ifconfig versus ipconfig versus ifconfig

This has happened to me so many times I thought I'd post a clarification here to help myself remember, while passing it off as a legitimate blog post topic. Clever yes? Don't answer that.

Having moved to Unix-like systems from Windows when I finished high school I'm used to firing up my shell and entering ifconfig with either the -a option or by specifying a specific network interface such as eth0 to find out DHCP assigned IP addresses, subnet masks, grilled cheese sandwiches and the like.

ipconfig on FreeBSD
Xfce Terminal on FreeBSD with ThinIce theme

As shown below, on Windows the command is deceptively similar in all but one letter: ipconfig. As with the classic DOS goodness Windows replaced the commands also accept flags with forward-slashes instead of short dashes.

ipconfig on FreeBSD
Command Prompt on XP with the least ugly Windows theme

ASIDE: According to the completely infallible Wikipedia, ifconfig sloppily stands for "interface configurator", whereas ipconfig stands for "internet protocol configuration". Don't you just love unambiguous commands?

It's interesting how our minds change isn't it? I started using our DOS desktop back before I even started primary school and I got so used to the commands they became second nature. Since moving to the wonderful world of FreeBSD and cross pollinating my knowledge on similar GNU/Linux, NetBSD, Mac OS X and OpenSolaris machines, my DOS knowledge hasn't been forgotten, but it's become something I have to "think" to use. If I had a cent for every time I attempted to type and use ls and top on Windows machines now, I'd have at least enough cash for a grilled cheese sandwich with at least avocado and onions.

Mac OS X Leopard Terminal.app
Mac OS X Leopard Terminal.app

Two grilled cheese sandwich references in one post, three including this sentence. I'm on a roll. Wait I'm not discussing eating a "roll", it's a "grilled cheese sandwich". Wait, that's four times. Grilled cheese sandwich.


Viewing images from the Terminal in Mac OS X

Viewing images from the Terminal in Mac OS X
You can pass multiple images to the Preview app, very nice!

The more I learn and love FreeBSD the more I've been using the Terminal application on my Macs, to the point now where I'm using it more than any other application except perhaps a web browser: for file file compression and management the command line is so much quicker and simpler. As a result I've been trying to modify my workflow to allow me to work inside the Terminal even more, and I thought I'd share some tips I've picked up here.

One such example is viewing images and other media from the Terminal. Just as you probably use the bundled Preview.app to do this when you're in the Finder or from the OPENSTEP days, you can also call it from the Terminal to do the same thing. For example, to load a picture called Geass.jpg:

/Applications/Preview.app/Contents/MacOS/Preview Geass.jpg

And voila, Preview opens showing you the image you told it to load... from the Terminal! You can pass multiple images seperated with spaces, you can even mix in a few PDFs into your list. The scripting potential is just making me quiver with excitement!

A Mac OS X package Why didn't I just call the Preview.app application itself? Apps in Mac OS X are actually neatly contained in bundles (a special kind of folder) alongside other resources such as help files. The executable you want to call from the Terminal therefore is the program itself contained in the bundle, not the bundle itself.

Unfortunately there's bad news. As a guy learning UNIX I thought I'd be able to just generate a symbolic link to the executable so I could use a much shorter command in a manner line this:

% sudo ln -s \
/Applications/Preview.app/Contents/MacOS/Preview \
/usr/local/bin/preview

Alas when I attempted to use the new command, I was given a plist error.

% preview geass.jpg
2009-01-03 02:28:47.810 preview[1470:807] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting

It seems for now you can just enter the previous full command using [TAB] auto-completion to make it easier, but as far as I know there's no way to shorten it. Writing a tiny shell script to interface with the app generated an identical response:

% less preview.sh
#!/bin/sh
/Applications/Preview.app/Contents/MacOS/Preview $_

There's probably a foolproof, ridiculously simple solution to this that I'm just not seeing right now. I'll keep you posted if I learn anything else.


Making Firefox 3 look like a Mac browser

In response to Google Reader's altered interface that made it much more difficult to use, I've reluctantly started using Mozilla Firefox as my primary browser on my MacBook Pro again. My opinion that Camino is the single greatest Mac browser on the planet remains unchanged, but for the time being I need a browser that has Greasemonkey or other user scriptable capabilities so I can keep using Reader.

Having really only used the Firefox 3.x series lightly in the past, moving over to it now made my appreciate how un-Mac like the interface has become and how much extra screen real estate it takes up without any discernible extra functionality when compared to Safari or Camino with UnifyCamino. Fortunately Firefox is skinnable, so I figured I could make it look more like a Mac app and reclaim some screen real estate. Unfortunately there were so many different Mac-like skins in Mozilla.org's Add-on database I didn't know where to start!

ASIDE: I never thought I'd use the words "fortunately" and "skinnable" in the same sentence! It seems with Gmail, Google Reader and Firefox I'm using their skinning features to return them to a previous state when they were far more usable. It's kind of ironic when you think about.

After installing and uninstalling theme after theme (after theme after theme...), I narrowed down what I consider to be the best authentic looking Mac themes to this handful here.

Default Firefox 3.x theme
I figured I'd put the default Safari and default Firefox 3.x theme here for comparison.

GrApple Yummy Blue and Graphite
These themes by Aronnax from TakeBackTheWeb.org are perfect: they reclaim veritable swaths of screen real estate (say what?) and they make Firefox look Safari and Mac like. The Firefox team needs to include this as the default theme.

GrApple Delicious Blue and Graphite
Variations on the above themes with more traditional Mac tabs. I prefer the above because they're smaller and look more modern, but you may Think Different.

Camifox for 3.1b1 and for 3.0.x
This theme uses the same gorgeous colours and icons of Camino, though it takes up a bit more screen real estate. It certainly is tempting though :)


Enabling the Processor preference pane

The Processor preference pane menu and Processor Palette on Mac OS X Leopard
The Processor menu and palette on Mac OS X Leopard

This tip is probably old news for most seasoned Mac users, but passing it on for people who may not know, and so I can link to it with other posts at some point.

Ever since the first PowerPC based Mac desktops with more than 1 CPU existed, there has been a small preference pane included in Apple's Developer Tools for Mac OS X you can install that allows you to disable multiple CPUs or CPU cores on the fly from your Apple menu bar, or from System Preferences. For desktops this is useful for cooling purposes when you don't intend to do much processing, for notebooks you can save battery power (most of the time) by only running one CPU core.

If you already have the Developer Tools installed from your Mac OS X installation DVD, navigate to /Developer/Extras/PreferencePanes/, double-click on Processor.prefPane then choose whether you want every account on the machine to be able to use it, or just yourself. For the former you'll need to provide an administrator's credentials.

Once it's installed, you'll have a processor icon on your menu bar which you can use to turn off some of your CPUs or CPU cores. You can also toggle a fancy "Processor Pallete" which shows a histogram of CPU usage.


Installing Alpine on Mac OS X

Build options available for Alpine in MacPorts
Build options available for Alpine in MacPorts

I've been asked by a few people on Twitter how I installed the lightweight Alpine console based email client on my Mac. Alpine of course is the current version of the pine email software that addressed some concerns about licencing. I love Alpine, and the logo reminds me of the classic Altavista :).

As with most free and open source software, by far the easiest way to get it running is just to install it from a package manager. You can go ahead and fetch the source tarball and do the usual ./configure, make, make install and make clean, but it does have several dependencies which in turn have several dependencies. You know what I mean.

MacPorts
For MacPorts, grab yourself the latest version and install just as you would any other Mac software that uses a setup assistant. Once you're up and running it's simply a matter of firing up your Terminal.app and entering in # port -v install alpine.

By entering # port variants alpine you can see all the custom options you can set. If you want to compile Alpine with one or more of these custom options, use the same install command above but append the options you want with plus signs. For example, if I wanted password files support I'd enter # port -v install alpine +passfile.

Fink
I haven't used Fink myself much, but according to their online package manifest it is available.
NetBSD's pkgsrc
If you use pkgsrc for Mac OS X/Darwin, Alpine can be found in the ./mail/alpine directory in your pkgsrc tree. Once you're in the right directory, it's the usual routine of # bmake install clean clean-depends. As with all pkgsrc packages on OS X, remember to use bmake NOT make otherwise it won't work.

If you're interested in trying the sophisticated and elegant pkgsrc system on your Mac, I wrote up a tutorial in a previous post you can use to get yourself up and running with it.

Happy emailing!


Ruben's epic Phantom of the Opera Ghost File

It's not often a computer manages to spook me; more often than not they tend to generate frustration instead. Today though I couldn't figure out why my Trash wasn't emptying after several Secure Delete options.

ASIDE: I'm aware Apple computers and Mac OS X are created in the United States, but I wish we could change the name of the "Trash" folder to "Rubbish" or "Bin"... renaming the accidental deletion folder is one of the first things I do whenever I install FreeBSD with Xorg on a desktop. I'm perfectly fine with most American English, but "Trash" really sets my teeth on edge.

Phantom file in the Trash

To figure out what was going on, I opened the Trash folder and saw one file was stubbornly refusing to disappear. Why it wasn't deleting itself was the least of my concerns though, because I couldn't even make out what the file even was, or what it was called!

Intrigued, I clicked on the file and entered [Command]+[I] to bring up the Get Info dialog box so I could see the creation date, where it had come from and so forth, but as if it was afraid to revel its identity the file instantly disappeared and the Trash emptied.

Phantom file in the Trash

Was that the end to this curious little file? Heavens no! I closed the Trash window but noticed that the icon had changed back to "full". Opening the Trash window again I noticed the file had mysteriously returned!

I continued this cycle another five or six times before giving up. The next step was to determine what the name of the file was itself; I couldn't read it all. I clicked the file again, but instead of attempting to open Get Info I entered [Command]+[C] to copy the filename. So far so good. I fired up trusty MacVim, pasted the clipboard contents and increased the font size:

Phantom filename in MacVim

The name of the file was... "nul"? In programming and computing in general "nul" of course refers to a lack of a value; it doesn't mean 0 it literally means "nothing". So each character in this file's name consisted of a unique character I had never seen before called "nul" stylised in a way I had never seen before. You can tell from the other, regular characters in the MacVim window how gigantic I had to make the average font size before I could read the tiny letters within each individual character. Spooky!

As of yet I've still been unable to delete this non-existent phantom ghost file. I'll be installing my new hard drive in this MacBook Pro soon however which will entail installing Mac OS X from scratch which will rid me of it. Still I would have liked to know what it was and how it got there. Even Google had no idea what it was!

Anyone else ever had experience with phantom files on Mac OS X or other operating systems in general? Why hasn't an opera been created about this? Don't answer that.

Even Google has no idea what that file was!


Freshly baked Camino 1.6.5 now out

Camino icons

For the benefit of those who use the greatest web browser on the planet, Camino has been updated to version 1.6.5.

According to the latest release page, the following changes have been made since 1.6.4:

  • Upgraded to version 1.8.1.18 of the Mozilla Gecko rendering engine, which includes several critical security and stability fixes.
  • Camino will no longer crash on startup when the Mac OS X spelling system is broken.
  • The General preference pane will no longer be missing for users who had customized the Preferences window toolbar.
  • The icon for the Google feed handler has been updated to match the new Google site icon.
  • Added CamiTools to the list of problematic add-ons.
  • Improved ad-blocking.

Windows 3.x on Mac OS X using DOSBox

Windows 3.1 on Mac OS X: DOS Nostalgia on Intel Mac Hardware!

As I mentioned in the previous post in this mini-series, one of the options for running Windows 3.x on Mac OS X is using the excellent little DOSBox DOS emulator. While it is akin to comparing minnows to sharks in features, the latest Mac build of DOSBox (0.72) weighs in at 10MiB, compared to VirtualBox 2.0.4's 34.6MiB or VMware Fusion's 247.6MiB.

DOSBox also has some distinct advantages other than filesize if you just want to run DOS. You don't need to worry about setting up your own copy of DOS from scratch, saving you the trouble of configuring AUTOEXEC.BAT and CONFIG.SYS, and all the graphics and audio for a huge slew of devices is already set up. For people interested in running Windows 3.x, DOSBox provides generic emulated hardware that you can easily install software for.

Setting it up

  1. Grab yourself a copy of DOSBox and install it.

  2. Create a folder in your home directory that will serve as you C:\ drive in DOSBox. Alternatively if you want to keep things neat and tidy, you can create a dedicated disk image using Disk Utility.

  3. Create another folder within your dosbox folder or your disk image called setup for example, then copy the contents of each Windows 3.x floppy disk into it.

  4. If you created a disk image, mount it in Mac OS X, then fire up DOSBox and map your image to c:\. Obviously if you created a folder, reference that instead:

    mount c /Volumes/[NAME OF IMAGE]

  5. Now you can navigate to your Windows installation files and start the setup process:

    z:\> c:
    c:\> cd setup
    c:\setup\> setup.exe

Installing Windows

When you see this, you're home free!
When you see this, you're home free!

The Windows 3.x installation process is fairly self explanatory, but just a few helpful pointers:

  1. Choose "Custom Installation" with your arrow keys during the DOS-based part of the installation.
  2. When you're asked, don't worry about using the option to search your drive for existing applications, there aren't any! Leave the option to install printers checked though.
  3. When you're asked about virtual memory, leave it with the default "Temporary" option. Because we're dealing essentially with a folder not a real file system, "Permanent" virtual memory won't work.
  4. You'll be asked if you want to make any changes to AUTOEXEC.BAT and CONFIG.SYS. Choose "Let you make the modifications later", because DOSBox won't use any boot files Windows creates anyway.
  5. When you get to the printer installation step, click the "Generic / Text Only" option and hit [Install...]. Windows in the day needed a printer, any printer, to display some fonts properly.

Creating a preferences file

To save yourself the trouble of writing out that nasty mount line each time you start DOSBox, and to allow yourself to tweak some performance options it's best to create a preferences file.

  1. Within DOSBox, enter the following (in one line):

    config -writeconf "/Users/[YOUR-USER-NAME]/Library/Preferences/DOSBox Preferences"

  2. Quit DOSBox then open the file you just created in your favourite text editor. At the very end of the file is where your custom AUTOEXEC.BAT code can be written. Enter the exact line you entered above to map your disk image or folder to drive c:.

  3. Under this, enter the following line to help Windows and DOSBox locate files:

    SET PATH=%PATH%;C:\WINDOWS

  4. If you intend to use DOSBox just to run Windows 3.x, add these lines right after your mount line so Windows starts when you start DOSBox, and DOSBox quits when Windows does:

    WIN
    EXIT

Starting Windows 3.x

Now you have a basic Windows 3.x installation running on your Mac! It's somewhat of a surreal sight:

Windows 3.1 on Mac OS X
Windows 3.1 on Mac OS X!

Drivers

It is possible to drivers to get better performance, graphics, sound etc. DOSBox emulates a generic SoundBlaster card and a custom S3 Trio graphics card. The VOGONS (Very Old Games On New Systems) forum has a thread dedicated to this. If I have time this week I'll elaborate further in a separate post, keep an eye on the dosonmac tag.