Titanium Command-Line Interface Reference
Edit

Titanium Command-Line Interface Reference

The Titanium Command-Line Interface (CLI) is a Node.js-based command-line tool for managing, building, and deploying Titanium projects. It is designed to replace the legacy Python CLI scripts used in previous releases, including titanium.py and the platform-specific builder.py scripts.

For this release, the legacy CLI scripts are still used for some portions of the build. In addition, creating and building modules is not yet supported in the new CLI. The legacy CLI can be used for this purpose. For details, see:

The new command-line interface is named titanium. If you have titanium aliased to the legacy titanium.py script, you should change the alias (for example, to titanium.py), to avoid conflicting with the titanium script.

For information on the Python build scripts, see Legacy Command-Line Interface.

If you experience issues building with Titanium Studio when using the new CLI, see Reverting Studio to the Legacy CLI.

CLI Quick Start

Getting started with the CLI only requires two steps:

  1. Install Node.js.

  2. Install and configure the CLI.

Install Node.js

The CLI requires Node.js 0.10.13 or later. If you don't have Node installed, install it from:

Before installing the CLI, you should decide where you want the Node Package Manager (npm) to install packages. By default npm installs into /usr/local on OS X and Linux, which requires that you run npm as root. This is not recommended. You can avoid having to run npm by doing one of the following:

  • Make the /usr/local directory writable by all:

    sudo chmod 777 /usr/local

  • Set npm to install to your home directory, or another directory of your choosing by setting the npm prefix. For example, you can add the following to your .bash_profile or other initialization file:

    export NPM_CONFIG_PREFIX=$HOME

    In this case, npm packages are installed to $HOME/lib/node_modules and launch scripts are installed in $HOME/bin. $HOME/bin must be in your PATH.

For more information, see Installing Node.

Install and Configure the CLI

  1. Install the titanium CLI.

    npm install titanium -g
  2. Log in using your Appcelerator credentials.

    titanium login

    You are prompted for your Appcelerator network login and password.

  3. Download a 3.0 or newer SDK.

    titanium sdk update --branch 3_0_X --default
  4. Configure CLI (optional).

    titanium setup

    The script prompts you to enter basic information, such as your name, default locale, default SDK version, and default workspace folder.

If you encounter an error installing titanium, see Troubleshooting npm Problems.

titanium Commands

If you don't specify all of the required options, titanium prompts you for the missing options.

Build

Builds and runs an application or module project.

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 titanium config app.sdk <sdk_version>.

  4. SDK select version.
    To check or change this version, run titanium sdk select.

titanium build --platform <platform> [--build-only] [--force] [--project-dir <value>] [--sdk <value>] [--log-level <level>] [ <platform_build_options> ]

Generic Build Options and Flags

Option

Description

-b, --build-only

Only perform the build; when specified, does not install or run the app.

-f, --force

Force a full rebuild.

--legacy

Deprecated since Release 3.2.0. Build using the old Python-based builder.py

--skip-js-minify

Bypasses JavaScript minification. Simulator builds are never minified. Only supported for Android and iOS.

--log-level <level>

Minimum logging level. Supported options are trace, debug, info, warn, and error.

-p, --platform <platform>

Target build platform: Supported values are android, ios, and mobileweb. (iphone and ipad are currently accepted as synonyms for ios.)

-d, --project-dir <directory>

Directory containing the project, otherwise the current working directory is assumed.

-s, --sdk <version>

Titanium SDK version to build with. If not specified, uses the configured default SDK.

Android Build Options

Option

Description

-A, --android-sdk <path>

Path to the Android SDK.

-B, --avd-abi <value>

Deprecated since Release 3.2.0. Use --device-id instead. ABI for the AVD.

-C, --device-id <name>

Name of the device or emulator to install the application to.

-D, --deploy-type <type>

Type of deployment when using an emulator. Type can be test or development.

-I, --avd-id <id>

Deprecated since Release 3.2.0. Use --device-id instead. ID for the AVD. The ID specifies the API level and supplementary APIs for an AVD. Run the command android list targets to see a list of AVD IDs.

-K, --keystore <path>

Location of the keystore.

--key-password <keypass>

Password of the keystore private key. Defaults to value specified with --store-password.

--liveview

Starts a LiveView session to let you quickly preview changes to your application's UI. Appcelerator Studio users, only.

-L, --alias <alias>

Alias for the keystore.

-O, --output-dir <dir>

Output directory (used when target is dist-playstore).

-P, --store-password <password>

Password for the keystore.

--password <password>

Renamed to --store-password in Release 3.2.0. Password for the keystore.

-S, --avd-skin <skin>

Deprecated since Release 3.2.0. Use --device-id instead. Skin for the AVD. Defaults to HVGA.

-T, --target <value>

Target to build for. Target can be emulator, device, or dist-playstore.

BlackBerry Build Options

Option

Description

-D, --debug-token <path>

Path to the debug token.

-A, --ip-address <address>

Simulator IP address or the device's development IP address.

-K, --keystore-password <value>

Password used to register the signing keys.

-N, --ndk <path>

Path to the BlackBerry NDK.

-O, --output-dir <path>

Output directory for the signed BAR file.

-P, --password <value>

Password used on the device.

-T, --target <value>

Target to build for. Target can be simulator, device, or distribute.

iOS Build Options and Flags

Option

Description

--force-copy

Forces files to be copied instead of symlinked for simulator builds only.

--force-copy-all

Identical to the --force-copy flag except this will also copy the 236.7 MB libTiCore.a file.

--liveview

Enables LiveView allowing you to quickly preview changes to your application's UI. Appcelerator Studio users, only.

--retina

Use the retina version of the iOS Simulator.

--sim-64-btin

In combination with the --tall and --retina flags, start the 64-bit tall version of the retina simulator.

--tall

In combination with --retina flag, start the tall version of the retina simulator.

-C, --device-id <name>

Name of the device or emulator to install the application to.

-D, --deploy-type <type>

Type of deployment (test or development). Only used when target is simulator or device.
Defaults to development when building for the iOS Simulator and defaults to test when building for iOS device.
When deploy type is set to test, all of your JavaScript code is minified and encrypted. Any JavaScript syntax errors, even files you are not using, will result in a build failure.

-V, --developer-name <name>

iOS Developer Certificate to use; required when target is device.

-F, --device-family <value>

Device family to build for (iphone, ipad, or universal).

-R, --distribution-name <name>

iOS Distribution Certificate to use; required when target is dist-appstore or dist-adhoc.

-I, --ios-version <value>

iOS SDK version to build for. Default: latest installed iOS SDK.

-K, --keychain <value>

Path to the distribution keychain to use instead of the system default; only used when target is device, dist-appstore, or dist-adhoc.

-O, --output-dir <dir>

Output directory. Only used when target is dist-adhoc.

-P, --pp-uuid <uuid>

Provisioning profile uuid; required when target is device, dist-appstore, or dist-adhoc.

-Y, --sim-type <type>

iOS Simulator type: iphone or ipad; only used when target is simulator.

-S, --sim-version <value>

iOS Simulator version; only used when target is simulator.

-T, --target <value>

Target to build for: simulator, device, dist-appstore, or dist-adhoc.

Mobile Web and Windows Hybrid Build Options

Option

Description

-C, --device-id <value>

Windows Phone 8 device or emulator to build for: de for device or xd for emulator.

-D, --deploy-type <type>

Type of deployment (production or development). Production performs optimizations.

-T, --target <value>

Target to build for: web for Mobile Web apps, winstore for Window 8 Store apps or wp8 for Windows Phone 8 apps.

--wp8-publisher-guid

Windows Publisher GUID. Required for Windows Phone 8 builds.

Tizen Build Options and Flags

Option

Description

--debug

Enable debug support for Tizen applications. Disabled by default.

-L, --alias <alias>

Alias for the keystore.

-D, --deploy-type <type>

Type of deployment (production or development). Production performs optimizations.

-E, --device <device_id>

ID for the Tizen device or emulator.

--key-password <value>

Password for the key.

--keystore <path>

Location of the keystore.

-P, --password <value>

Password for the keystore.

Clean

Removes the build directories for an application or module project.

titanium clean [ --platform <platform> ] [--project-dir <value>] [--sdk <value>] [--log-level <level>] 

Clean Options

Option

Description

--log-level <level>

Minimum logging level. Supported options are trace, debug, info, warn, and error.

-p, --platform <platform>

A single platform to clean: android, ios, and mobileweb.

-d, --project-dir <directory>

Directory containing the project, otherwise the current working directory is assumed.

-s, --sdk <version>

Titanium SDK version to build with. If not specified, uses the configured default SDK.

Config

Gets and sets configuration options. If no key is specified, then all key/values are returned.

titanium config [--remove] [--output <value>] [<key>] [<value>]

Config Options

Option

Description

-a, --append

Appenda a value to a key containing a list of values.

-r, --remove

Removes the specified config key and all its descendants.

-o, --output <value>

Selects the output format: report or json. Defaults to report.

Create

Creates a new application or module project.

titanium create [ --platform <platform> ] [--project-dir <value>] [--sdk <value>] [--log-level <level>] 

Create Options

Option

Description

-f, --force

Force creation of the project, even if the path already exists.

--id <value>

Application ID. For uniqueness, application IDs should be based on a registered domain name, in reverse-DNS order (for example, com.example.mygreatapp).

--log-level <level>

Minimum logging level. Supported options are trace, debug, info, warn, and error.

--template <value>

Project template to use--either a name of a template to use or files to copy over to the newly created project. The file to be copied over can either be placed in a directory, ZIP file or ZIP file with a remote URL.

-d, --workspace-dir <value>

Directory to place the project in. Defaults to the workspace directory set in the titanium configuration, if any.

-n, --name <value>

Name of the project. Used as the default human-readable name for the project.

-p, --platform <platform>

Comma-separated list of platforms: supported values are android, ios, and mobileweb. (iphone and ipad are currently accepted as synonyms for ios.)

-s, --sdk <version>

Titanium SDK version to build with. If not specified, uses the configured default SDK.

-t, --type <value>

Type of project to create (app or module). Defaults to app.

-u --url <value>

Your company/personal URL.

Help

Displays the help screen.

titanium help

Info

Displays development environment information.

titanium info [--output <value>] [--types <value>]

Info Options

Option

Description

--legacy

Outputs results using the old format

-o, --output <value>

Selects the output format: report or json. Defaults to report.

-t, --types <value>

Comma-separated list of types to display: all, os, nodejs, titanium, ios, jdk, haxm and android. Defaults to all.

Login

Logs into the Appcelerator network.

titanium login <username> <password>

Logout

Logs out of the Appcelerator network.

titanium logout

Module

Manages installed Titanium modules.

titanium module [<subcommand>]

Module List

Prints a list of installed modules.

titanium module list [--output <value>] [--project-dir <value>]
Module List Options

Option

Description

-o, --output <value>

Selects the output format: report, json or grid. Defaults to report.

--project-dir <value>

Directory of the project to analyze. Defaults to the current working directory.

Plugin

Manages installed Titanium plugins.

titanium plugin [<subcommand>]

Plugin List

Prints a list of installed plugins.

titanium plugin list [--output <value>] [--project-dir <value>]
Plugin List Options

Option

Description

-o, --output <value>

Selects the output format: report, json or grid. Defaults to report.

--project-dir <value>

Directory of the project to analyze. Defaults to the current working directory.

Project

Gets tiapp.xml settings.

titanium project [--output <value>] [--project-dir <value>] [--template <value>] [--sdk <value>] [--log-level <level>] [<key>] [<value>]

Project Options

Option

Description

--log-level <level>

Minimum logging level. Supported options are trace, debug, info, warn, and error.

-o, --output <value>

Selects the output format: report, json or text. Defaults to report.

--project-dir <directory>

Directory containing the project, otherwise the current working directory is assumed.

-s, --sdk <version>

Titanium SDK version to build with. If not specified, uses the configured default SDK.

--template <value>

Project template to use.

SDK

Manages installed Titanium SDKs.

titanium sdk [<subcommand>]

SDK Install

Downloads the latest Titanium SDK or a specific version.

titanium sdk install [<version>] [--default] [--force] [--branch <branch name>]

<version> may be either a specific version number, such as 3.1.3.GA or a URL to a continuous integration build, such as http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_1_X/mobilesdk-3.1.3.v20130904134612-osx.zip.

To override this behavior, set the sdk.defaultInstallLocation key to a path where you want to install the SDKs, for example:

ti config sdk.defaultInstallLocation /path/to/intall/sdks
SDK Install Options

Option

Description

-d, --default

Sets as the default SDK.

-f, --force

Forces reinstallation.

-k, --keep-files

Keep downloaded files after install.

-b, --branch <branch name>

Branch to install or "latest".

SDK List

Prints a list of installed SDK versions.

titanium sdk list [--branches] [--releases] [--output <value>]
SDK List Options

Option

Description

-b, --branches

Retrieves and prints all branches.

-r, --releases

Retrieves and prints all releases.

-o, --output <value>

Selects the output format: report or json. Defaults to report.

SDK Select

Used to select which installed Titanium SDK is the active SDK. This is not the SDK your application will be built with but the SDK used to run the CLI commands. However, if the tiapp.xml file does not contain an SDK version or the app.sdk setting is not set with titanium config, then the application will be built with the SDK select version. If the SDK selected is ever deleted or if you are missing CLI commands, select a new active SDK.

titanium sdk select [<version>]

SDK Uninstall

titanium sdk uninstall [<version>] [--force]

Uninstalls a specific Titanium SDK version.

SDK Uninstall Options

Option

Description

-f, --force

Forces uninstallation without confirmation.

SDK Update

Finds the latest version of the Titanium SDK.

titanium sdk update [--default] [--force] [--install] [--branch <branch name>]
SDK Update Options

Option

Description

-d, --default

Sets as the default SDK.

-f, --force

Forces reinstallation.

-i, --install

Installs the latest version.

-b, --branch <branch name>

Branch to update from.

Setup

Runs the setup wizard.

titanium setup

Setup Options

Option

Description

-a, --advanced

Removed in Release 3.2.0. Prompts for all configuration options.

Status

Displays session information.

titanium status [--output <value>]

Status Options

Option

Description

-o, --output <value>

Selects the output format: report or json. Defaults to report.

Reverting Studio to the Legacy CLI

If you experience problems building in Studio when using the new CLI, you can revert to the legacy CLI.

  1. Edit your Studio initialization file (TitaniumStudio.ini) as described in Modifying Your Configuration.

  2. Add the following to the file:

    -vmargs 
    -Dtitanium.bypassNewCLI=true

    If there is already a -vmargs line in the file, simply add the -Dtitanium.bypassNewCLI=true after -vmargs.

  3. Save the file and restart Studio.