Each new release of Mac OS X brings with it a range of new command-line tools, many of which go unnoticed. Not only are these tools useful, they also tell the story of the evolution of the OS. Leopard is no exception, so armed with a couple of old and unevolved commands, ls and diff, I set about finding out what’s new in /usr/bin on Leopard. What follows is far from comprehensive, but I hope it at least touches on some of the more interesting developments. For those who want more, there’s always ls and diff. Here’s what I found…

The Mac OS X Leopard Family Pack is a single-residence, five-user license Preview files without opening an application using Quick Look The Mac OS X Leopard Family Pack is a single-residence, five-user license Introduces more than 300 new and enhanced features to OS X, including a new desktop. Mac OS X Leopard: Mac OS Leopard is version 10.5 of Mac OS X for Apple’s personal computers. Mac OS Leopard was the last version to support the PowerPC architecture that did not include Intel-based Macs. Mac OS Leopard was the successor of Mac OS Tiger and was superseded by Snow Leopard (version 10.6).

Performance, Performance, Performance

Many have made the observation that Leopard is more a developer’s release than a end user’s release, and looking at the improvements in the new developer tools, it’s hard to deny. From Xcode to Interface Builder and Instruments, developing software on Leopard is a whole lot more attractive than it was on Tiger, and there are just as many improvements under the cover.

One of biggest changes is the introduction of DTrace, which is a platform for profiling your software — and the system — without having to compile with special flags or anything like that.

One way to access DTrace is to use the new Instruments graphical tool (formerly X-Ray). You may not realize it, but Instruments has a command-line counterpart called — wait for it — instruments, which allows you to use the tools you create in the application in your command-line scripts.

Aside from Instruments, DTrace is used in many other tools on Leopard. List the /usr/bin directory and you will see many files with the extension .d, which are DTrace scripts. To run one, you can start up the dtrace command with the -s option, but most of the scripts will take care of this for you in the she-bang, so you can just run the script directly, e.g.,

Note that you have to use the sudo command, because only superusers can run dtrace.

Here are some of the DTrace scripts you will find that may be of use in profiling your system:

What
  • bitesize.d – Analyse disk I/O size by process.
  • creatbyproc.d – File creates by process name.
  • httpdstat.d – Realtime httpd statistics.
  • hotspot.d – Plot disk event by location, look for hotspots.
  • cpuwalk.d – Measure which CPUs a process runs on.
  • weblatency.d – Measures web latency.

The weblatency.d script is fun to play with: start it up, and then navigate to a web site in Safari or Firefox. Now use Cmd-C to stop the script, and it will print the latency on each of the web site downloads. Pretty cool, even if it is more for web developers than scientists.

In addition to the DTrace scripts, Apple has utilized DTrace to provided a number of new commands. These commands do not have a .d extension, but they do use DTrace, and must be run as superuser.

  • dappprof – Profile user and lib function usage.
  • dapptrace – Trace user and library function usage.
  • diskhits – Disk access by file offset.
  • dtruss – Process syscall details.
  • iosnoop – Snoop I/O events as they occur.
  • iotop – Display top disk I/O events by process.
  • fddist – File descriptor usage distributions.
  • opensnoop – Snoop file opens as they occur.
  • plockstat – Front-end to DTrace to print statistics about POSIX mutexes and read/write locks.
  • procsystime – Analyse system call times.
  • rwsnoop – Snoop read/write events.
  • sampleproc – Sample processes on the CPUs.
  • topsyscall – Top syscalls by syscall name.
  • topsysproc – Top syscalls by process name.

This list includes quite a few tools, but the ‘top-like’ ones caught my eye: iotop, topsyscall, and topsysproc. top is a very useful command for getting continuously-updated data on what is occupying your CPU, and the new tools allow you to do the same thing at the system call and the file levels. Have you ever wondered why your hard disk suddenly burst into life for no apparent reason? In the past, I have used fs_usage to discover the culprit, but from now on, I think I will use iotop to find out which process is thrashing the disk.

Parallelism Rules

Apple and other vendors are starting to take parallelism more seriously. Cocoa includes new classes for parallelizing applications, and Leopard now has OpenMPI built in. OpenMPI is an implementation of the Message-Passing Interface (MPI), which allows for SPMD parallel applications to be written for shared- and distributed-memory systems. OpenMPI commands include mpic++, mpicc, and mpicxx for compiling, and mpiexec and mpirun for executing MPI apps. Unfortunately, Mac OS X doesn’t include a standard Fortran compiler, so although you will find mpif77 and mpif90, they don’t do anything. There is also the ompi_info Wine for mac wiki. command, which prints information about the OpenMPI installation.

Microsoft for macos

Bridges and Scripting Languages

Another shift in the development landscape brought about by Leopard is better support for bridging to scripting languages like Python and Ruby. BridgeSupport allows developers to write Cocoa apps in languages other than Objective-C, but you can also support scripting in your own frameworks. To do this, you use the tool gen_bridge_metadata to scan the interface of your C or Objective-C framework, and generate the required XML file Virus.

Another type of bridging also snuck under the radar: the swig tool has been included. SWIG also allows you to relatively easily bridge scripting languages to native code, and its a nice addition to the OS.

Leopard includes a number of other scripting-related commands, such as rails, for Ruby on Rails; gem, for Ruby package management; easy_install, for Python package installation; and config_data, for configuring Perl modules. Speaking of Perl, there is now support for building GUI apps with wxWidgets; for a demo, run the wxperl_demo.pl script.

Security Software Development

I have already discussed many tools of use to software developers, but there are many more. For example, if you want to open a file from the command line in Xcode’s editor, use the new xed command.

Mac

A couple of other tools point to the security improvements that have been made in Leopard: The codesign command allows developers to sign their code, so that it can be verified when installed on a user’s system. And the sandbox-exec command can be used to run an application in a sandbox, which can be used to restrict access to system resources.

Source control management has been improved with the inclusion of Subversion (svn) and SVK (svk), and the project management tool Maven (mvn) also got a guernsey.

Those developing Quicklook plugins will find qlmanage very useful, and anyone that wants to build text-based categorization into their apps (think Junk in Mail) need look no further than the Latent Semantic Mapping support provided by lsm.

Odds and Ends

To finish off, here are a few tools that didn’t really fit into any of the categories above: A perl-based command called lwp-download is designed for large file downloads from the web, and the xar command provides tar-like archiving in an extensible format. xmlwf can tell you if an XML file is well formatted, and xpath can be used to extract data from XML files using an approach similar to regular expressions.

All in all, Leopard’s got a lot to offer, much of it below the glossy, transparency-rich veneer that many have taken exception to. It’s the first UNIX-compliant version of Mac OS X, and as you would expect from any UNIX system, there’s plenty of command-line goodness for us all, and then some. Next week, /usr/sbin … only joking.

Subscribe to this site's feed ››
Add to Google Toolbar ››
Submit News ››

Help, Guides, and News on making the Switch To Apple Macintosh Computers

Featured Guides

Macintosh Guides

Mac

How to Switch

How to Switch

What is Leopard?

  • guides
  • Leopard | Mac OS X
Leopard, also known as Mac OS X Leopard, is the current release version of Apple's Mac OS X operating system that runs on the company's Macintosh computers. Leopard was released on October 26, 2007. Leopard has been designated a version number of 10.5 and is the 6th version OS X version that Apple has released since early 2001. Leopard contains more that 300 new features when compared to Tiger, the prior version of Mac OS X.
Some of the new, noteworthy, and/or improved features of Leopard include:
  • Boot Camp - Run Windows Vista and Windows XP on your Mac at native speed with full compatibility. Boot Camp was a beta (test) software in the prior Intel-based version of Mac OS X, specifically Tiger (version 10.4)
  • Spaces - Organize your activities into separate virtual spaces and easily switch from one to another.
  • Time Machine - The automatic backup solution built into the core of Mac OS X. Time Machine automatically makes copies of everything on your Mac including documents, digital photos, music, movies and TV shows, and documents. Recovery of your files from an earlier time is now possible. Time Machine makes backups on a regular basis thereby allowing users to scroll back in time to review past file versions and drag them from the past to your Mac. This is very useful to obtain prior file version, lost files or files that were inadvertently deleted.
  • Quick Look - with a single click you can easily view the contents of files without ever opening them. Look into text files, PDF documents, images, movies, Keynote presentations, Microsft Excel and Word documents, and Mail attachment. Quick Look even works in Time Machine.
  • Downloads Stack - Find your downloads quickly in one dedicated stack that's easily located in the Mac OS X Dock.
  • Finder - a new and improved Finder makes browsing files on a Mac easier than ever. You can flip through files using Cover Flow or using an iTunes-style sidebar. Finder now allows you to participate in an interactive screen sharing session with other Macs on your network.
  • iChat Theater - allows users to show iPhoto slide shows, QuickTime movies, and Keynote presentations, within a chat session with other iChat users.
For an overview and history of Mac OS X, please read What is Mac OS X.

Updates

  • April 12, 2009 - Content revision
Created: 12:42 PM on Oct 17, 2007
By: switchtoamac

Recent Guides

  • What is Lion?
    What is Disk Utility?
    What is Boot Camp Assistant?
    What is Snow Leopard?
    What is Airport Utility?
    What is Activity Monitor?
    Quickly navigate to the Utilities folder
    What are Utilities?
    Forward delete on a Mac keyboard
    Show or Hide Sidebar items via Preferences
    Determine which updates have been installed by Software Update
    Disable automatic updates in Software Update
    Manually run Software Update on Mac OS X Leopard
    Different ways to launch a Mac OS X Application
    Expose for Apple keyboards that have volume controls on F9, F10, and F11
    What is MobileMe Gallery?
    What is iWeb?

Visit the Guides List

Recently Updated

  • What is Lion?
  • What is Mac OS X?
  • MacBook Pro
  • MacBook Air
  • MacBook
  • Choose Your Mac
  • The Mac Models
  • What are Utilities?
  • What is Disk Utility?
  • What is Boot Camp Assistant?
  • What is Snow Leopard?
  • What is Airport Utility?
  • What is Activity Monitor?
  • Quickly navigate to the Utilities folder
  • Expose for Apple keyboards that have volume controls on F9, F10, and F11
  • Forward delete on a Mac keyboard
  • Show or Hide Sidebar items via Preferences
  • Customize the Sidebar - Hide and Show
  • Finder and Sidebar - an Ideal Combination

Recent Articles


Apple to offer free OS X Lion upgrade for new Macs via the Mac OS X Lion Up-To-Date program
Forbes: Apple Gets Predatory With Lion OS Pricing
Town of Wellesley Massachusetts - 'Macs Apple of their eye'
WWDC 2011 - Apple's SVP of Product Marketing Phil Schiller, discusses the State of the Mac
WWDC 2011 begins today - Mac OS X Lion, iOS 5 and iCloud unveiling sets the stage for a Unified Apple PlatformMac

Snow Leopard For Mac Download


Apple CEO Steve Jobs to introduce Apple's next generation software Mac OS X Lion, iOS 5, and iCloud during WWDC Keynote Address on Monday, June 6
Amazon launches a Mac Download Store - software and games for your Mac
AllThingsD - The Mac is kicking ass
Where in the world are Mac sales growing? Everywhere.
Corporate Mac sales surge 66 percent as Apple makes significant enterprise headway

Mac Leopard Os


What Is Snow Leopard For Mac

Parallels Transporter an app that makes it easier to switch from a Windows PC to a Mac

Snow Leopard Mac Os


Snow Leopard Mac Os Download

RSS Feed · Guides RSS Feed · About · Shop · Privacy Policy · Terms of Use · Best viewed in Safari, Firefox, and Internet Explorer 7 or higher
Copyright © 2011 Switch To A Mac · All rights reserved. · All trademarks and copyrights remain the property of their respective owners.