Command-line documentation lookup for Cocoa APIs, in the spirit of RI

View project onGitHub

Cocoadex parses Cocoa documentation files and creates a keyword index. Queries can then be run against the index for fast documentation lookup.


gem install cocoadex


gem update cocoadex && cocoadex --configure


Load any DocSets in known locations:

cocoadex --configure


View Options

cocoadex --help

Loading a Custom DocSet

cocoadex --load-docset [path] --load-docset [path2] ...

Look up Documentation

cocoadex [query]

Class Reference

Valid search terms are Class, method, and property names. Search scope can also be focused using delimiters, such as Class-method to find instance methods, Class+method to find class methods, or Class.method to find any matching method or property in Class.

Functions, Constants, Data Types, Callbacks, Structs...

Valid search terms are function, constant, data type, callback and struct names, as well as constant groups (e.g. cocoadex "Social Profile Keys").

Enabling Tab Completion

Cocoadex generates a tags file of all indexed search terms during configuration.


Enable tab completion for bash by linking/saving tools/ and adding the following to your .bash_profile (or similar):

complete -C /path/to/ -o default cocoadex

Z Shell

Add the following to your .zshrc to enable tab completion for zsh:

_cocoadex() {
    local cocoa_prefix
    read -l cocoa_prefix
    reply=(`cdex_completion "$cocoa_prefix"`)

compctl -K _cocoadex cocoadex

Example Output

Property Lookup Example

$ cocoadex tableView

-------------------------------------------------------------- tableView

@property(nonatomic, retain) UITableView *tableView
Returns the table view managed by the controller object.

Available in iOS 2.0 and later.

Method Lookup Example

$ cocoadex tableView:viewForFoo

-------------------------------------- tableView:viewForFooterInSection:

  - (UIView *)tableView:(UITableView *)tableView

Returns: A view object to be displayed in the footer of section .
Asks the delegate for a view object to display in the footer of the
specified section of the table view.


    The table-view object asking for the view object.
    An index number identifying a section of tableView .

Available in iOS 2.0 and later.

Class Lookup Example (Clipped for brevity)

$ cocoadex UILabel

--------------------------------------------------------- Class: UILabel
                                       (UIView > UIResponder > NSObject)

Describes a control for displaying static text.



Instance Methods:
  drawTextInRect:, textRectForBounds:limitedToNumberOfLines:

  adjustsFontSizeToFitWidth, baselineAdjustment, enabled, font,
  highlighted, highlightedTextColor, lineBreakMode, minimumFontSize,
  numberOfLines, shadowColor, shadowOffset, text, textAlignment,
  textColor, userInteractionEnabled