Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

196 lines (113 sloc) 8.48 kb


GRMustache is a flexible and production-ready implementation of Mustache templates for MacOS Cocoa and iOS.

GRMustache targets iOS down to version 4.3, MacOS down to 10.6 Snow Leopard (with or without garbage collection), and only depends on the Foundation framework.

January 12, 2013: GRMustache 6.1.4 is out. Release notes

Don't miss a single release: follow @GRMustache on Twitter.

How To

1. Setup your Xcode project

Option 1: CocoaPods

Dear CocoaPods users, append pod 'GRMustache', '~> 6.1' to your Podfile.

Option 2: Static Library

The distribution includes pre-built static libraries:

Clone the repository with the git clone command.

  • For MacOS development, add include/GRMustache.h and lib/libGRMustache6-MacOS.a to your project.
  • For iOS development, add include/GRMustache.h and lib/libGRMustache6-iOS.a to your project.

If you have GRMustache files copied in your project, you'll need to copy all header files of the include directory, not only GRMustache.h.

The armv6 slice is not included. In order to target this architecture, you have to compile GRMustache yourself (see below), or to use CocoaPods (see above).

Option 3: Compiling the raw sources

You may also embed the raw GRMustache sources in your project:

$ git clone
$ cd GRMustache
$ git checkout v6.1.4  # checkout the latest stable release
$ git submodule update --init src/vendor/groue/jrswizzle

Add all files of src/classes plus src/vendor/groue/jrswizzle/JRSwizzle.* to your project.

If your project uses ARC, flag the source files with the -fno-objc-arc compiler flag (how to).

In your own sources, avoid importing header files whose name ends with _private.h: those are private headers that may change, without notice, in future releases.

2. Start rendering templates

#import "GRMustache.h"

// Renders "Hello Arthur!"
NSString *rendering = [GRMustacheTemplate renderObject:[Person personWithName:@"Arthur"]
                                            fromString:@"Hello {{name}}!"

// Renders a document from the `Profile.mustache` resource
NSString *rendering = [GRMustacheTemplate renderObject:[Person personWithName:@"Arthur"]


Mustache syntax



  • Introduction: a tour of the library features, and most common use cases.

Loading templates:

Rendering templates:

  • Runtime: how to provide data to templates

Advanced Mustache:

Sample code


  • Reference: the GRMustache reference, automatically generated from inline documentation, for fun and profit, by appledoc.


  • Forking: the forking guide tells you everything about GRMustache organization.


  • Q: How do I render array indexes?

    A: Check the Collection Indexes Sample Code

  • Q: How do I format numbers and dates?

    A: Check the Number Formatting Sample Code

  • Q: How do I render partial templates whose name is only known at runtime?

    A: Check the Rendering Objects Guide

  • Q: Does GRMustache provide any layout or template inheritance facility?

    A: Check the Partials Guide.

  • Q: How do I localize templates?

    A: Check the Localization Sample Code

  • Q: How do I render default values for missing keys?

    A: Check the Tag Delegate Guide.

  • Q: What is this NSUndefinedKeyException stuff?

    A: When GRMustache has to try several objects until it finds the one that provides a {{key}}, several NSUndefinedKeyException are raised and caught. Let us double guess you: it's likely that you wish Xcode would stop breaking on those exceptions. This use case is covered in the Runtime Guide.

  • Q: Why does GRMustache need JRSwizzle?

    A: GRMustache does not need it. However, you may happy having GRMustache swizzle valueForUndefinedKey: in the NSObject and NSManagedObject classes when you invoke [GRMustache preventNSUndefinedKeyExceptionAttack]. The use case is described in the Runtime Guide.

What other people say


I'm loving grmustache


Oh man GRMustache saved my ass once again. Awesome lib.


GRMustache filters extension saved us from great escaping PITAs. Thanks @groue.


Thank fucking christ for decent iOS developers who ship .lib files in their Github repos. #GRMustache

Popular projects & apps using GRMustache

Contribution wish-list

Please look for an open issue that smiles at you!

... And I wish somebody would review the non-native English of the documentation and guides.


Please fork. You'll learn useful information in the Forking Guide.


Released under the MIT License.

Jump to Line
Something went wrong with that request. Please try again.