Skip to end of metadata
Go to start of metadata

Titainum provides a command-line interface to check and configure your environment setup, create and build applications, and much more. The Titanium CLI is distributed as apart of the Appcelerator CLI. Please refer to Appcelerator CLI Getting Started for details on installing the Appcelerator CLI.

 Run appc ti --help to see all available target options or see the Titanium Command-Line Interface Reference.

Development environment

Before using the Titanium CLI to create and build Titanium projects, you need to make sure your development environment is correctly configured.

Check your development environment

To check if you current development environment is setup correctly to build projects, run the appc ti setup check command. This command will report what tools are configured to work with the CLI.

Output Examples:

The following output indicates that node and npm are installed correctly but may be updated.

The following output indicates that your Android environment is not setup correctly.

Check the development environment against the Titanium SDK

The appc ti info command retrieves detailed information about your platform environment, such as Android SDKs installed, and iOS certificates and provisioning profiles. Use this command to check if your currently selected Titanium SDK supports your development environment.

Output Examples:

The following output indicates that your Android environment is not setup correctly and provides you with some resolution steps.

The following output indicates that your iOS environment is fine, but you have older versions of Xcode installed.

Configuring your development environment

By default, the Titanium CLI uses your environment variables to search for paths to executables and other development tools. If you installed these tools in custom locations or the CLI cannot find them, you will need to use the appc ti config command to tell the CLI where to find these tools. The example below sets some common Android configuration options. For a detailed list of configurable options, see Titanium CLI Options.

Building applications

Once you have your development environment correctly configured, you can create and build Titanium applications.

Create a Titanium project

To create a new Titanium project, run the appc new command. The CLI will prompt you to fill in the necessary information to create a project, such as which platforms the application runs on and the name of the project. To create a new project with all the information specified in the command, run: 

Build an application

To build a Titanium project to test on a device, simulator or emulator, run the appc run command from the project directory. The CLI will prompt you to fill in the necessary information to build the project, such as which platform you want to test the application on. More detailed examples are listed below.

Once the application is installed and launched, use native tools to test, debug and profile your application. See Debugging and Profiling.

Icon

SDK version setting precedence

The CLI checks several settings to see which SDK version to use to build your application. The following is a list of locations in the order of precedence. If an SDK version is not defined in that location, the next location is checked.

  1. tiapp.xml file version specified with the sdk-version tag.
    To change this version, manually edit the tiapp.xml file with a text editor or use Studio.
  2. --sdk command-line option with the titanium build command.
  3. app.sdk setting specified with the titanium config command.
    To check the version, run titanium config and to change the version, run appc ti config app.sdk <sdk_version>.
  4. SDK select version.
    To check or change this version, run appc ti sdk select.

Android emulator

You need to create an Android emulator or setup Genymotion before running these commands.

To build for an emulator, run appc run -p android. Because no other options were specified, the CLI launches your default Android emulator and installs the application on it.

To launch a specific Android or Genymotion emulator, add the -C <EMULATOR_NAME> option.  

To retrieve a list of Android or Genymotion emulators, run the appc ti info -p android command.

Android device

To build for an Android device, connect your device to the computer with a USB cable, then run:

iOS simulator

To build for an iOS simulator, run appc run -p ios. Because no other options were specified, the CLI launches the application on the default iOS simulator.

To use a specific simulator, add the -C <SIMULATOR_NAME> option.

To retrieve a list of simulator names, run the appc run --help option and look at the -C, --device-id option under the "Build iOS Options".  

iOS device

Before deploying to an iOS device for testing, you need to generate a development certificate and development provisioning profile. See Deploying to iOS devices.

The CLI allows you to install your application directly to the device connected to your computer with a USB cable.

To build for an iOS device, run:

If you omit the -V and -P options, the CLI will prompt you with options. You can also retrieve the information from Xcode's Devices window (or Organizer window for Xcode 5.x and older) or with the appc ti info -p ios command.

Windows Mobile Emulator

To build for Windows Mobile Emulator, run appc run -p windows. Because no other options were specified, the CLI launches the application on the default Windows Mobile Emulator.

To use a specific emulator, add the -C <EMULATOR_ID> option.

Windows Mobile device

Due to the Windows SDK tooling, Titanium only supports installing to a single connected device at a time. Therefore, you do not need to specify a device using the -C option.

Windows local machine

To build a Titanium app for your Windows desktop, you will need to build for your local machine.

Package an application

Google Play APK

Before packaging an APK file for distribution, you need to generate a keypair and certificate for your application.  See Distributing Android apps.

To package an APK for Google Play, run:

If you omit any of the optional parameters, you will be prompted by the CLI to enter these values. If the password for the private key of the keystore is different from the password for the keystore, add the --key-password <KEYPASS> option with the password of your private key.

iOS ad hoc distribution

Before packaging for the iOS ad hoc distribution, you need to generate a distribution certificate and distribution provisioning profile. See Distributing iOS apps.

To package an IPA file for Ad Hoc distribution, run:

If you omit any of the optional parameters, the CLI will prompt you with options.

iTunes Store

Before packaging for the iTunes Store, you need to generate a distribution certificate and distribution provisioning profile, and have an iTunes Connect account. See Distributing iOS apps.

Icon

If you are using Mac OS X 10.9 (Mavericks) or newer, make sure you grant CLI access to the computer as described in Note for Mavericks (and later).

To package an APP bundle for the iTunes store, run:

The CLI installs the package to Xcode's Organizer and launches Organizer for you to start the submission process.

If you omit any of the optional parameters, the CLI will prompt you with options.

Windows Store

Titanium apps can be published for the Windows Store or the Windows Mobile Store. Please refer to the build help (appc run --help) for detail of how to specify your Windows Publisher GUID and distribution certificates.

Clean your build folder

If you run into issues building your application, you may need to clean your build folder.  Run the ti clean command or to clean for a specific platform, add the -p <PLATFORM> option.