TweetFollow Us on Twitter

An Open Source Primer

Volume Number: 21 (2005)
Issue Number: 10
Column Tag: Programming

An Open Source Primer

A Practical Guide to Using Open Source Software (OSS) on Mac OS X for the Non-Developer

by Emmanuel Stein

Introduction

Readers of Dean Shavit's "The Source Hound" and Ed Marczak's "Mac In The Shell", are no doubt familiar with open source software (OSS). With Darwin as OS X's core, many if not most of the Mac OS's most critical components are based on, if not entirely built upon, open source projects. To exploit the capabilities of OS X it is, therefore, critical to have a good grasp of OSS and the many ways you can leverage open source solutions on the Mac.

For Mac aficionados without a UNIX background, the world of open source can be rather daunting at first. Given all the distribution formats out there and the occasional need to compile software, it is not surprising that many Mac Users have not exploited OSS beyond what comes with OS X. Even non-developers who know how to compile their software, often run into issues with source code that requires special compiler options to successfully compile, or for which they may need to edit the Makefile and the like. Dependencies are also a source of problems and are often at the root of problems getting OSS to run properly. Finally, there is the issue of source code not ported to the Mac OS or Darwin, for which one requires a cross compiler. Source code not ported to the Mac OS regularly stumps many users who do not realize that source code is frequently machine dependant in nature and therefore may not work on all platforms.

There is hope, however. Package management systems like Fink and Open Darwin Ports (think Apple Software Update for OSS) offer automatic downloading, compilation and linking, as well as updating. Although these tools are wonderful and make acquiring and deploying OSS a breeze (even for GUI diehards), they do not always include every piece of OSS you may want or need. Also, newer projects may not even have packages available, much less be indexed by the extant package management systems. In such situations, many people may give up and possibly look for a "safe" commercial alternative. I hope to change that with this primer by going over the convenient package management tools available, and going over the simple steps for compilation. Further, I will show you how to identify and where to find OSS that has been ported to the Mac.

Though, it is beyond the scope of a primer to go into porting OSS to the Mac, I will nevertheless touch on the conceptual issues involved. If nothing else, it will enable readers to better understand why certain code does not compile on the Mac and for more adventurous readers, shows where to find the porting instructions in a source distribution.

If you are a developer or UNIX geek, you will likely be familiar with the subjects covered. However, for the rest of us, get ready to enter the wonderful world of OSS. Far from being a "developer-only" community, the rich and vibrant world of OSS is chock full of cutting edge and highly useful non-developer tools like GIMP (Graphic Image Manipulation Program) and Blender (an advanced 3D modeling tool). Moreover, with the advent of OS X and object oriented desktop environments like Gnome and KDE, the OSS universe has become increasingly accessible to GUI folks. With every passing day, open source developers are innovating and facilitating methods of OSS distribution. Whether via an Aqua wrapper to X11-based applications, like Aqua Ethereal, or via graphical front-ends to package management tools, such as Fink's Fink Commander and Open Darwin Port's Port Authority, OSS developers are clearly making every effort to reach the Mac audience.

What Exactly is Open Source Software Anyway?

Open source, is typically used to refer to non-proprietary software, distributed with source code and a "copyleft" style license, allowing anyone to add new features to, or improve the source code as they see fit. Open source is however, more than a way of distributing software. It is a way of life with a deeply evolved philosophy that is all about fun and exploration in an intellectual arena. Central to that philosophy is the notion of hacking and an evolved spirit of play that goes beyond concepts of work and survival, to paraphrase Eric S. Raymond, a prominent OSS advocate and one of the few to have successfully hacked the three major open source UNIX projects: LINUX, BSD, and GNU. There are also practical characteristics specific to OSS that go beyond the qualification of providing the source code in a software distribution. Specifically, to "officially" qualify as open source, software must meet a set of well-defined guidelines set forth in the several extant open source licensing schemes. These include the BSD artistic License, the X11 license, GPL and other "compatible" license formats (see http://www.gnu.org/licenses/license-list.html). Though these licensing schemes differ slightly they are united by a similar philosophy that is delineated by the Open Software Initiative's (OSI) Open Source Definition (OSD) v1.9, whose axioms are available at (http://www.opensource.org/docs/definition.php).

Conceptually, open source, also represents a new paradigm in software development. To use the terminology coined by Raymond, in his seminal treatise "The Cathedral and the Bazaar," OSS employs the Bazaar model of development while traditional, closed source software, represents the "Cathedral Model." Without going into the details of each development model and its respective benefits and weakness, I have outlined the characteristics of open source software below:

  • Releases are made as frequently as possible. There is usually a stable and an unstable release, the later with more features, but in need of testing.
  • Users of the software, whether developers or not, contribute to the development, documentation and distribution of the software. This participation is a key element in the growth and sustainability of the OSS movement and is a way of giving back. User participation varies from submitting bug reports to taking an active role in the development of a project.
  • The source is made available with the intent of enabling users to hack the source for educational and practical purposes.
  • Whenever possible it is best to avoid forking development (e.g. The split with Emacs and xemacs is a good example of this) and duplicating effort. The ultimate goal is to work together to extend existing projects and only introducing novel projects to fill a niche not already saturated.
  • Design the program, when possible, to be easily ported to as many other platforms as possible and embrace modularization of code for facilitated distribution of development work.

Prerequisites

The vanilla install of OS X is packed with so much OSS the list is too long to reproduce here. However, so as not to rattle users who may be unfamiliar with these tools, Apple, being Apple cleverly hid them from view, much as they did the Terminal application. Even every-day applications like Safari are based on open source projects. In fact, without OSS there would be no Mac OS X!

The point is, with a standard install you can use all the OSS bundled with the Mac OS and many outside projects that are specifically packaged for the Mac. These include the OSS listed on Apple's OS X downloads page in the "UNIX & Open Source" section. However, if you want to use any OSS that requires, god forbid, compilation, or software which relies on the X11 windowing system, you have to go beyond the vanilla install.

The following is a list of the pre-requisites required for many if not most of the OSS mentioned in this primer. Installing this recommended software will enable you to get the most out of what is available in the open source community and ensure that you do not run into dependency issues.

  • If you haven't done so already, install Apple's X11 implementation. This is a custom option for the standard Mac install and can be found among the packages located on the install DVD for Tiger under the System>Library>Packages directory, for those of you who have already installed OS X and just need to add that package.
  • The Developer Tools CD contains a rich array of Apple modified OSS needed for compiling software, as well as, many of the dependencies upon which OSS projects rely. Although the standard install of Developer tools will be adequate for most needs, I recommend also installing the X11 SDK and the optional compiler packages.

Note: Once you have installed the developer tools, be sure to repair permissions, as they will be changed in the process of installation and, if not remedied, may adversely affect your system performance.

Open Source the Easy Way With Fink and Darwin Ports

Both Fink and Darwin Ports are amazing package management systems designed specifically to enable Mac users to benefit from the diverse range of OSS without having to manually compile or port source code. In addition to having easy to use command line interfaces, both Fink and Darwin Ports have mature GUIs that match virtually every available terminal option (Figures 1-4).


Figure 1. Darwin Ports' PortBase Graphical installer and Updater


Figure 2. Darwin Ports' PortView


Figure 3. FinkCommander GUI

These environments are ideal for both novice and experienced users, who simply want the equivalent of Apple's Software Update for their OSS. Frankly, I use both all the time on my work machine to get my OSS fix. Although I have been known to compile the occasional program, I have gotten so used to these wonderful utilities that I hardily ever have to compile these days. Each package manager offers access to a bewildering array of software, with Darwin Ports having 2,292 packages and Fink having 5,013 packages across 23 categories! What's more, via the GUI, you can choose to install the binary or source versions for maximum flexibility. Even if you only use Fink or Darwin Ports for one piece of OSS software, it is worth the download and install. Both detect dependencies for your desired package and automatically download and install the support files for you. This dependency checking feature alone has saved me countless hours hunting down library files and widget kits needed to run a simple OSS application. Finally the distribution options for these package managers is phenomenal, with .dmg all in-one installers familiar to any OS X user and the ability to obtain the source directly via cvs. Choose one or both, but Fink and Darwin Ports are must-have additions to any Mac user's OSS toolkit.

To Compile or Not To Compile...

Often OSS will come in a variety of package and binary formats. While many, given the choice, will instinctively go for the binary or packaged formats, there are certain benefits to compiling. These include, the ability to better monitor the installation, to effectuate custom configurations, or for reasons of security. Regarding the last point, it is rare that package maintainers are ever malicious and, provided you get your package or binary from a reputable source (e.g. sourceforge.org, freshmeat.net, are two popular examples), you risk little or nothing. Ditto, for users of package utilities like Fink and Open Darwin Ports. Users of these utilities can also compile from source.

Regardless of whether your preference is for pre-compiled and packaged binaries or source auto-compiled using Fink, there will come a day, mark my words, when you will need to compile a piece of OSS. It may be because the binaries were not updated for the latest OS update, or because there are no OS X packages out there and/or your package utility has not indexed the particular piece of OSS you need. While I know many people who would prefer to eat a bug than open the terminal and compile software, developers often make it very easy to compile their source code. Much of the time the following terminal command is all that is needed:

$ ./configure && make && make install

There are, nonetheless, instances in which this command will not suffice. We will discuss this further in the next few sections and offer reasons, as well as, tips for doing more advanced compiling. We will also cover what porting source to the Mac involves.

Where To Find Mac Friendly Source Code

Although, sites specifically geared towards OSS on the Mac exist, they are often limited to pre-made packages and can be lacking in terms of breadth and quantity of OSS software. In contrast, platform independent sites like sourceforge.org and freshmeat.net not only offer Mac-specific source and binaries, but also offer a rich and centralized repository for the latest and greatest in OSS. I have seen many advertisements for CD distributions of Mac compatible OSS binaries and source, but have always felt that these missed the whole point of OSS: To distribute up-to-date builds with frequent patching, that frankly only a medium like the Internet will allow.

What's in the Source?

With all this talk of source code, you might be wondering what it is and how it is distributed. Even though compilation is usually accomplished with a simple three-step command (e.g. configure && make && make install), knowing what to look for in a source distribution can go a long way to ensuring a successful build of your OSS.

Your typical source distribution comes packaged as a compressed tarball (e.g. mysourcecode.tar.gz). When expanded and untarred, the source distribution will likely contain several files including .c and .h files, which represent the source code and header files, with README, INSTALL, and sometimes PORT files. Although most source code is written in a version of the C programming language, hence the .c files, other distributions may be written in perl, python, and a host of other languages. As such, you may encounter distributions without .c and .h files. However, Perl and Python do not require compilation, as they are interpreter-based scripting languages and are thereby much easier to deploy.

For easy compilation, developers often supply a configure script that is generated with the autoconf OSS utility. Alternatively, you may find that your OSS distribution uses the xmkmf script to invoke the imake program, which, in turn, will construct the make files needed for compilation. When confronted with OSS based on imake, be sure to read the INSTALL file for details. However, in most cases the following command can be employed to generate necessary files for compilation:

$ xmkmf -a

The compilation may then be completed by issuing the following terminal command:

make && make test && make install

There will also be cases in which no configure script is supplied with the source. You may, nevertheless, generate one by executing the autoconf.sh script. Please note that this applies only to source, which is based upon autoconf. Most commonly, you will run into this scenario when obtaining the source directly from a CVS (Control Versioning System) repository on the Net. As previously mentioned, you should then be able to run the configure command, followed by the make and make install commands. Though this is the typical manner in which compilation is effectuated, be sure to read the INSTALL file, as it should contain more precise install instructions. The PORT file, mentioned earlier offers suggestions for developers wishing to port the OSS to another UNIX platform, like OS X.


Figure 4. A view of a typical autoconf-based source distribution

What if the Source Code for The Software I want Isn't Mac Compatible?

Unless specifically designed to be platform independent, the source code has to have been ported to the Mac architecture in order to compile and run on OS X. Unfortunately, the Mac is not binary compatible with Linux, so even Linux packages ported to the PowerPC architecture are not usable. Mac OS X differs notably from Linux, SVR 4-based systems, and other Unix variants in its lack of support of the Executable and Linking Format (ELF). The binary format specific to OS X is Mach-O. This is why even PowerPC architecture specific source and binaries are a no go in OS X.

If the OSS you need is not available for OSX, consider using an emulator or configure a dual boot option with Yellow Dog Linux, for instance. Unless you are a developer and are willing to give up a significant amount of your free time to port the OSS, the options I mentioned are your only choice. On the plus side, however, is that with each passing day more and more OSS is being ported to OS X, which though not totally Open Source itself, has become one of the leading OSS platforms.

A Call To Arms

Although OSS is free, characterizing it as simply "free software" misses the essence of the OSS philosophy and the hacker ethic from which it originated. The open source movement, along with the Internet has enabled developers to adopt a radically different development model. This new model, termed the "Bazaar" by Raymond, has and continues to prove itself as a preferred model for software development and distribution and will continue to make inroads into virtually all areas of the technoverse. Built on a foundation of cooperation, group effort, and imbued with a spirit of play and intellectual curiosity, OSS represents a novel paradigm for the exchange of ideas and has the potential to fundamentally alter how we think of and use technology. Moreover, the detailed philosophies coming out of the open source movement offer a dramatic and compelling alternative to the traditional Protestant ethic, which values work for work's sake. The vision presented by the OSS movement is of a more evolved and egalitarian society, in which the joy of hacking transcends the Protestant work ethic. As part of the Mac community, it is our collective responsibility, to not only take from the rich array of OSS, but to give back as well. For developers the meaning here is very clear. However, non-developers are far from excluded and play a crucial role as software testers, technical writers, and distributors of OSS. I urge you all to take the plunge into the world of OSS. Together, we can take ownership of the technologies upon which we depend and really make a Jobsian "dent in the universe!"


Emmanuel Stein has been an avid Mac user since 1984 and has honed his cross-platform skills while working at France Telecom, Time Magazine and Reed-Elsevier. He has recently started his own Mac-centric consulting company, MacVerse, which offers implementation, system administration and development services geared towards the enterprise market. As a diehard GNU/Linux geek, he enjoys hacking open source software and experimenting with new open source projects on OS X. You may reach him at macverse@mac.com

 
AAPL
$99.76
Apple Inc.
+2.09
MSFT
$44.08
Microsoft Corpora
+0.45
GOOG
$520.84
Google Inc.
+9.67

MacTech Search:
Community Search:

Software Updates via MacUpdate

Macgo Blu-ray Player 2.10.9.1750 - Blu-r...
Macgo Mac Blu-ray Player can bring you the most unforgettable Blu-ray experience on your Mac. Overview Macgo Mac Blu-ray Player can satisfy just about every need you could possibly have in a Blu-ray... Read more
Apple iOS 8.1 - The latest version of Ap...
The latest version of iOS can be downloaded through iTunes. Apple iOS 8 comes with big updates to apps you use every day, like Messages and Photos. A whole new way to share content with your family.... Read more
TechTool Pro 7.0.5 - Hard drive and syst...
TechTool Pro is now 7, and this is the most advanced version of the acclaimed Macintosh troubleshooting utility created in its 20-year history. Micromat has redeveloped TechTool Pro 7 to be fully 64... Read more
PDFKey Pro 4.0.2 - Edit and print passwo...
PDFKey Pro can unlock PDF documents protected for printing and copying when you've forgotten your password. It can now also protect your PDF files with a password to prevent unauthorized access and/... Read more
Yasu 2.9.1 - System maintenance app; per...
Yasu was originally created with System Administrators who service large groups of workstations in mind, Yasu (Yet Another System Utility) was made to do a specific group of maintenance tasks... Read more
Hazel 3.3 - Create rules for organizing...
Hazel is your personal housekeeper, organizing and cleaning folders based on rules you define. Hazel can also manage your trash and uninstall your applications. Organize your files using a... Read more
Autopano Giga 3.7 - Stitch multiple imag...
Autopano Giga allows you to stitch 2, 20, or 2,000 images. Version 3.0 integrates impressive new features that will definitely make you adopt Autopano Pro or Autopano Giga: Choose between 9... Read more
MenuMeters 1.8 - CPU, memory, disk, and...
MenuMeters is a set of CPU, memory, disk, and network monitoring tools for Mac OS X. Although there are numerous other programs which do the same thing, none had quite the feature set I was looking... Read more
Coda 2.5 - One-window Web development su...
Coda is a powerful Web editor that puts everything in one place. An editor. Terminal. CSS. Files. With Coda 2, we went beyond expectations. With loads of new, much-requested features, a few... Read more
Arq 4.6.1 - Online backup to Google Driv...
Arq is super-easy online backup for the Mac. Back up to your own Google Drive storage (15GB free storage), your own Amazon Glacier ($.01/GB per month storage) or S3, or any SFTP server. Arq backs up... Read more

Latest Forum Discussions

See All

This Week at 148Apps: October 13-17, 201...
Expert App Reviewers   So little time and so very many apps. What’s a poor iPhone/iPad lover to do? Fortunately, 148Apps is here to give you the rundown on the latest and greatest releases. And we even have a tremendous back catalog of reviews; just... | Read more »
Angry Birds Transformers Review
Angry Birds Transformers Review By Jennifer Allen on October 20th, 2014 Our Rating: :: TRANSFORMED BIRDSUniversal App - Designed for iPhone and iPad Transformed in a way you wouldn’t expect, Angry Birds Transformers is a quite... | Read more »
GAMEVIL Announces the Upcoming Launch of...
GAMEVIL Announces the Upcoming Launch of Mark of the Dragon Posted by Jessica Fisher on October 20th, 2014 [ permalink ] Mark of the Dragon, by GAMEVIL, put | Read more »
Interview With the Angry Birds Transform...
Angry Birds Transformers recently transformed and rolled out worldwide. This run-and-gun title is a hit with young Transformers fans, but the ample references to classic Transformers fandom has also earned it a place in the hearts of long-time... | Read more »
Find Free Food on Campus with Ypay
Find Free Food on Campus with Ypay Posted by Jessica Fisher on October 20th, 2014 [ permalink ] iPhone App - Designed for the iPhone, compatible with the iPad | Read more »
Strung Along Review
Strung Along Review By Jordan Minor on October 20th, 2014 Our Rating: :: GOT NO STRINGSUniversal App - Designed for iPhone and iPad A cool gimmick and a great art style keep Strung Along from completely falling apart.   | Read more »
P2P file transferring app Send Anywhere...
File sharing services like Dropbox have security issues. Email attachments can be problematic when it comes to sharing large files. USB dongles don’t fit into your phone. Send Anywhere, a peer-to-peer file transferring application, solves all of... | Read more »
Zero Age Review
Zero Age Review By Jordan Minor on October 20th, 2014 Our Rating: :: MORE THAN ZEROiPad Only App - Designed for the iPad With its mind-bending puzzles and spellbinding visuals, Zero Age has it all.   | Read more »
Hay Ewe Review
Hay Ewe Review By Campbell Bird on October 20th, 2014 Our Rating: :: SAVE YOUR SHEEPLEUniversal App - Designed for iPhone and iPad Pave the way for your flock in this line drawing puzzle game from the creators of Worms.   | Read more »
My Very Hungry Caterpillar (Education)
My Very Hungry Caterpillar 1.0.0 Device: iOS Universal Category: Education Price: $3.99, Version: 1.0.0 (iTunes) Description: Care for your very own Very Hungry Caterpillar! My Very Hungry Caterpillar will captivate you as he crawls... | Read more »

Price Scanner via MacPrices.net

2013 15-inch 2.0GHz Retina MacBook Pro availa...
B&H Photo has leftover previous-generation 15″ 2.0GHz Retina MacBook Pros now available for $1599 including free shipping plus NY sales tax only. Their price is $400 off original MSRP. B&H... Read more
Updated iPad Prices
We’ve updated our iPad Air Price Tracker and our iPad mini Price Tracker with the latest information on prices and availability from Apple and other resellers, including the new iPad Air 2 and the... Read more
Apple Pay Available to Millions of Visa Cardh...
Visa Inc. brings secure, convenient payments to iPad Air 2 and iPad mini 3as well as iPhone 6 and 6 Plus. Starting October 20th, eligible Visa cardholders in the U.S. will be able to use Apple Pay,... Read more
Textkraft Pocket – the missing TextEdit for i...
infovole GmbH has announced the release and immediate availability of Textkraft Pocket 1.0, a professional text editor and note taking app for Apple’s iPhone. In March 2014 rumors were all about... Read more
C Spire to offer iPad Air 2 and iPad mini 3,...
C Spire on Friday announced that it will offer iPad Air 2 and iPad mini 3, both with Wi-Fi + Cellular, on its 4G+ LTE network in the coming weeks. C Spire will offer the new iPads with a range of... Read more
Belkin Announces Full Line of Keyboards and C...
Belkin International has unveiled a new lineup of keyboard cases and accessories for Apple’s newest iPads, featuring three QODE keyboards and a collection of thin, lightweight folios for both the... Read more
Verizon offers new iPad Air 2 preorders for $...
Verizon Wireless is accepting preorders for the new iPad Air 2, cellular models, for $100 off MSRP with a 2-year service agreement: - 16GB iPad Air 2 WiFi + Cellular: $529.99 - 64GB iPad Air 2 WiFi... Read more
Price drops on refurbished Mac minis, now ava...
The Apple Store has dropped prices on Apple Certified Refurbished previous-generation Mac minis, with models now available starting at $419. Apple’s one-year warranty is included with each mini, and... Read more
Apple refurbished 2014 MacBook Airs available...
The Apple Store has Apple Certified Refurbished 2014 MacBook Airs available for up to $180 off the cost of new models. An Apple one-year warranty is included with each MacBook, and shipping is free.... Read more
Refurbished 2013 MacBook Pros available for u...
The Apple Store has Apple Certified Refurbished 13″ and 15″ MacBook Pros available starting at $929. Apple’s one-year warranty is standard, and shipping is free: - 13″ 2.5GHz MacBook Pros (4GB RAM/... Read more

Jobs Board

Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Position Opening at *Apple* - Apple (United...
…customers purchase our products, you're the one who helps them get more out of their new Apple technology. Your day in the Apple Store is filled with a range of Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** At the Apple Store, you connect business professionals and entrepreneurs with the tools they need in order to put Apple solutions to work in their Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** The Apple Store is a retail environment like no other - uniquely focused on delivering amazing customer experiences. As an Expert, you introduce people Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.