1.6. Mac OS X's Unix Development Tools
The
version of
Unix that you'll
encounter in Mac OS X's Terminal is similar to other
versions you have seen, but dissimilar in some fundamental and often
surprising ways. Although most tools are in their usual place, some
are not on the system, while others are not where you would typically
expect to find them on other Unix systems.
The lists shown in this section contain a sampling of the Unix
commands developers will find on Mac OS X. It is, by no means, a
complete list of the Unix utilities found on your system. Because
there are so many commands, they are organized into several
categories. If you are an experienced Unix user, many of these
commands will be familiar to you, but we've
referenced them here so you can quickly determine whether or not a
command you need is available. Unless otherwise specified, all of the
tools in the following lists can be found in
/usr/bin or
/usr/libexec. Some tools are available with the
standard distribution of Mac OS X, but others are available only
after installing the Developer Tools. (See Chapter 4 for more information about the Developer
Tools). Appendix B contains a listing of
commands that don't have manpages on Mac OS X.
1.6.1. Standard Unix Development Tools
The following commands are development tools that are commonly found
on Unix and Linux systems.
- bison
-
A yacc-compatible parser generator.
- cvs
-
A high-level revision control system that sits on top of RCS.
- flex
, flex++
-
A tool that generates lexical analyzers. See lex &
yacc (O'Reilly).
- cc
, gcc
-
Apple's customized version of
gcc, the GNU C compiler.
- gdb
-
A source-level debugger.
- gnumake, make
-
Tools that automate the steps necessary to compile a
source code package. See
Managing Projects with make
(O'Reilly).
- rcs
-
A command that manages file revisions.
- unzip
-
A tool that extracts files from a zip archive.
- zip
-
A command that creates a zip archive.
1.6.2. Apple's Command-line Developer Tools
The
following
list of utilities can be found in
/Developer/Tools after you have installed the
Developer
Tools package. Project Builder depends on some of these tools. Many
of these tools have their roots in
Macintosh Programmer's
Workshop (MPW), Apple's old development environment.
- agvtool
-
Acts as a versioning tool for Project Builder projects.
- BuildStrings
-
Creates resource string definitions.
- CpMac
-
Serves as an alternative to cp; preserves
resource forks when copying.
- cvs-unwrap
-
Extracts a tar file created by cvs-wrap.
- cvs-wrap
-
Combines a directory into a single tar file.
- cvswrappers
-
Checks an entire directory into CVS as a binary file.
- DeRez
-
Displays the contents of a resource fork.
- GetFileInfo
-
Displays extended information about a file, including creator code
and file type.
- lnresolve
-
Returns the target of a symbolic link.
- MergePef
-
Merges code fragments from one file into another.
- MvMac
-
Serves as an alternative to mv; preserves
resource forks when copying.
- pbhelpindexer
-
Creates an index of Apple's API documentation for
Project Builder.
- pbprojectdump
-
Used by Project Builder's FileMerge feature to
produce more readable diffs between file versions.
- pbxcp
-
Supports Project Builder's build system; an internal
tool.
- pbxhmapdump
-
Debugs header maps; also internal to Project Builder.
- ResMerger
-
Merges resource manager resource files. Project
Builder's build system compiles
.r files into .rsrc files
using Rez, and if needed, Project Builder merges
multiple files using ResMerger.
- Rez
-
Compiles resource files.
- RezWack
-
Embeds resource and data forks in a file.
- sdp
-
Converts a scripting definition file into another format.
- SetFile
-
Sets HFS+ file attributes.
- SplitForks
-
Splits the resource fork, moving it from a dual-forked file into a
file named ._pathname.
- UnRezWack
-
Removes resource and data forks from a file.
- WSMakeStubs
-
Generates web service stubs from a WSDL file.
Also available in the /Developer/Tools directory
is a Perl script (uninstall-devtools.pl), which
can be used to uninstall the Developer Tools.
1.6.3. Macintosh Tools
You can use the following tools to work with
Macintosh files and disks, Macintosh
applications, and the Macintosh clipboard.
- bless
-
Makes a system folder bootable.
- diskutil
-
Manipulates disks and volumes.
- ditto
-
Copies directories, and optionally includes resource forks for copied
files.
- hdiutil
-
Manipulates disk images.
- installer
-
Installs packages; command-line tool.
- lsbom
-
Lists the contents of a Bill of Materials (bom) file, such as the
.bom files deposited under
/Library/Receipts.
- open
-
Opens a file or directory. See
"open" under Section 1.5.4, earlier in this chapter.
- pbcopy
-
Copies standard input to the clipboard.
- pbpaste
-
Sends the contents of the clipboard to standard output.
- screencapture
-
Takes a screenshot of a window or the screen.
- serversetup
-
Configures network adapter properties. (Mac OS X Server
only.)
1.6.4. Java Development Tools
You can use the following tools to develop, debug, and run
Java applications.
- appletviewer
-
A Java applet viewer.
- jar
-
A Java archive tool.
- java
-
The Java Virtual Machine.
- javac
-
The Java compiler.
- javadoc
-
A Java documentation generator.
- javah
-
A tool that generates C and header files for JNI programming.
- javap
-
A tool that disassembles class files and inspects member signatures.
- jdb
-
The Java Debugger.
- jikes
-
A fast open source Java compiler (installed as part of the Developer
Tools package).
1.6.5. Text Editing and Processing
You can use the following tools to edit, convert, and otherwise
manipulate
text.
- awk
-
A pattern-matching language for textual database files.
- cut
-
A tool that selects columns for display.
- emacs
-
GNU Emacs.
- ex
-
A line editor underlying vi.
- fmt
-
A tool that produces roughly uniform line length.
- groff
-
A document formatting system that can render
troff typesetting macros to PostScript, HTML,
and other formats.
- join
-
A tool that merges different columns into a database.
- paste
-
A utility that merges columns or switches their order.
- pico
-
A simple text editor designed for use with the Pine mailer. Note that
the version of pine that ships with Mac OS X is
much older than the current release.
- sed
-
A stream editor.
- texi2html
-
A tool that converts Texinfo to HTML.
- tr
-
A command that substitutes or deletes characters.
- vi
-
A visual text editor.
1.6.6. Scripting and Shell Programming
The following commands include shells and programs useful in
shell scripts.
- echo
-
A command that repeats command-line arguments on standard output.
- expr
-
A command that performs arithmetic and comparisons.
- line
-
A command that reads a line of input.
- lockfile
-
A command that makes sure that a file is accessed by only one script
at a time.
- perl
-
The Practical Extraction and Report Language.
- printf
-
A command that formats and prints command-line arguments.
- sh
-
A standard Unix shell.
- sleep
-
A command that causes a pause during processing.
- tclsh
-
The Tool Command Language (Tcl) shell.
- test
-
A command that tests a condition.
- xargs
-
A command that reads arguments from standard input and passes them to
a command.
- zsh
-
An enhanced Unix shell.
1.6.7. Working with Files and Directories
You can use the following tools to
compare, copy, and examine files.
- cat
-
Concatenates and displays files.
- cd
-
Changes directory.
- chflags
-
Changes file flags.
- chmod
-
Changes access modes on files.
- cmp
-
Compares two files, byte by byte.
- comm
-
Compares two sorted files.
- cp
-
Copies files.
- diff
-
Compares two files, line by line.
- diff3
-
Compares three files.
- file
-
Determines a file's type.
- head
-
Shows the first few lines of a file.
- less
-
Serves as an enhanced alternative to more.
- ln
-
Creates symbolic or hard links.
TIP:
Symbolic and hard links are not the same as Carbon aliases that you
create in the Finder (File Make Alias). Unix
programs cannot follow Carbon aliases, but all Mac OS X applications
(Carbon, Cocoa, Classic, and Unix) can follow symbolic or hard links.
- ls
-
Lists files or directories.
- mkdir
-
Makes a new directory.
- more
-
Displays files one screen at a time.
- mv
-
Moves or renames files or directories.
- patch
-
Merges a set of changes into a file.
- pwd
-
Prints the working directory.
- rcp
-
Insecurely copies a file to or from a remote machine. Use
scp instead.
- rm
-
Removes files.
- rmdir
-
Removes directories.
- scp
-
Secures alternative to rcp.
- sdiff
-
Compares two files, side-by-side and line-by-line.
- split
-
Splits files evenly.
- tail
-
Shows the last few lines of a file.
- vis
-
Displays nonprinting characters in a readable form.
- unvis
-
Restores the output of vis to its original form.
- wc
-
Counts lines, words, and characters.
- zcmp
-
Compares two compressed files, byte-by-byte.
- zdiff
-
Compare two compressed files, line-by-line.
1.6.8. File Compression and Storage
The following tools will compress, decompress, and archive
files.
- compress
-
A tool that compresses files to free up space (use
gzip instead).
- cpio
-
A utility that copies archives in or out.
- gnutar
-
The GNU version of tar; available only if you
have installed the Developer Tools package.
- gunzip
-
A tool that uncompresses a file that was compressed with
gzip.
- gzcat
-
A utility that displays contents of compressed files.
- gzip
-
A tool that compresses a file with Lempel-Ziv encoding.
- tar
-
A tape archive tool. GNU tar has more features
and fewer limitations.
- uncompress
-
A utility that expands compressed (.Z) files.
- zcat
-
A tool that displays contents of compressed files.
1.6.9. Searching and Sorting
You can use the following tools to search and sort files.
- egrep
-
An extended version of grep.
- fgrep
-
A tool that searches files for literal words.
- find
-
A utility that searches the system for filenames.
- grep
-
A tool that searches files for text patterns.
- locate
-
A faster version of find; however, it depends on
a database that is periodically updated by the weekly
cron job in /etc/weekly. If
the database is out of date, find will be more
accurate.
- sort
-
A tool that sorts a file (use -n for numeric
sorting, -u to eliminate duplicates).
- strings
-
A tool that searches binary files for text patterns.
- uniq
-
A utility that reports or filters duplicate lines in a file.
- zgrep
-
A tool that searches compressed files for text patterns.
1.6.10. Miscellaneous Tools
The following tools will help you perform such tasks as searching the
online documentation, switching user IDs, and controlling how
programs run.
- apropos
-
Locates commands by keyword.
- clear
-
Clears the screen.
- dc
-
Serves as a reverse-polish arbitrary precision calculator.
- man
-
Gets information on a command.
- nice
-
Changes a job's priority.
- nohup
-
Keeps a job running even if you log out.
- passwd
-
Changes your password.
- script
-
Produces a transcript of your login session.
- su
-
Allows you to become the superuser. Since the
root account is disabled by default, you should
use sudo instead.
- sudo
-
Executes a command as another user. This tool is usually used to
temporarily gain superuser
privileges.
| | |
1.5. Using the tcsh Shell | | 2. Startup |
Copyright © 2003 O'Reilly & Associates. All rights reserved.