This note describes how I use OS X as a programmer's tool, for
Every developer uses different tools and has different preferences. Other programmers may need other tools and processes; most of them are supported on OS X. (These notes are based on my current use of OS X 10.8, Mountain Lion.)
What makes a Mac good for programming?
These notes apply to Snow Leopard through El Capitan.
Apple provides a complete free set of system development tools free with OS X. Install them from the Internet, or from the DVD that came with the computer. In a Terminal window, type xcode-select --install and accept the license.
The tools include C and C++ compilers, all the Unix tools like Perl, rsync, make, etc. and also Apple's programming development environment including Xcode, header files, docs, and auxiliary tools. (A free subscription to the Apple Developer Connection lets you download additional tools and information for developing Mac and iPhone applications.)
Java is a powerful modern programming language.
Java is safe for programming and development when used sensibly. Apple provides an optional complete Java runtime environment and compiler. Updates now come from (Oracle) Javasoft. Apple has disabled Java applets in web browsers by default in OS X, because of security attacks by malicious websites. (See http://support.apple.com/kb/DL1572.)
Oracle now packages Java 8 with a control panel viewed in.
Emacs is my text editor of choice and has been for over 30 years. I use Aquamacs Emacs, derived from Emacs 24 and adapted to the Mac by David Reitter, and customize its settings to be like Emacs on other platforms.
Perl is a wonderful quirky text processing language.
Perl is free and included with Mac OS X system tools. I have written many personal tools in Perl and used them on multiple platforms. Perl is also useful for writing server-side web applications.
CPAN, the Comprehensive Perl Archive Network, is a free community-provided library of Perl programs.
To install Perl modules, do sudo -H cpan and then issue CPAN commands.
Some CPAN bundles I use are Bundle::CPAN, DBI, DBD::mysql, Crypt::CBC, Crypt::Twofish, Net::DNS, Net::Subnet, News::NNTPClient, Geo::IP::PurePerl, Digest::SHA, Compress::Raw::Zlib, Compress::Raw::Bzip2
MySQL is a free relational database, now owned by Oracle. It is straightforward to download and install on the Mac. Among other uses, I create web pages such as the indexes for this website by loading a database with tabular information and then generating HTML from a MySQL query.
MacPorts provides hundreds of Open Source Unix tools compiled for OS X, free.
I use MacPorts to install uni2ascii, ImageMagick, subversion, psutils and other tools.
ImageMagick is a free package of image processing programs. One thing I use it for is automatically generating thumbnails for picture galleries. I install my version from MacPorts.
Apache is a widely used and powerful web server, included in OS X. It is useful for testing web applications before deploying them on a server. You can add features to it by editing its configuration files in /etc/apache2. Apache is shipped with OS X but not enabled in Lion and later versions. See the instructions for Mavericks if you wish to run it.
PHP, Python, and Ruby are scripting languages, included in OS X. You can enable their use in Apache by editing the Apache configuration files. You may wish to install later versions from MacPorts.
I use an experimental fork of HTML Tidy from W3C that handles HTML5. See http://w3c.github.com/tidy-html5/
A drawing tool oriented toward diagrams and charts is very useful. OmniGraffle Pro is slick (I like it better than Microsoft Visio on Windows, or trying to draw in PowerPoint).
If you are doing web development with graphics, you may be able to avoid spending the $120/yr that Photoshop costs from Adobe. You can get a version of GIMP for OS X, or buy Adobe Elements or Affinity Photo. But Photoshop is still the leader; I find it more powerful and easier to use.
If you open the Apple Terminal application, you have a bash shell window, and can write and run complex Unix scripts. I often have many shell windows open, for different tasks I'm working on.
I saved default Terminal settings so that when I launch Terminal I get three shell windows with different colored backgrounds. These help me remember what I am doing when I multi-task.
If you want to know more about these, Google or use man.
.bash_profile invokes ssh-add for keys, adds/opt to the PATH for MacPorts, then calls ...
.bashrc sets up PATH to contain $HOME/bin, then calls ...
thvv.bashrc defines my personal macros, then invokes ...
thvv.bvars defines variables local to the computer
.inputrc sets behavior for the Bash shell. My preferences are:
set bell-style none set completion-ignore-case On set mark-symlinked-directories on
I keep personal shell scripts, Perl programs and modules, and utilities in a subdirectory ~/bin of my home directory. There are over 300 files there. Some of these tools have been incrementally tweaked and developed over more than 20 years, on whatever system I was using at the time. (Probably half are obsolete.) When I need to write a new tool, I often start from an old one and modify it. (This can be a time saver, but risks the propagation of programming errors.) Remember what I always say: "If it's worth doing, it's worth writing a tool that does it."