Guides and Sample Code

Developer

Instruments User Guide

On This Page

Launch Instruments

The Instruments app lives inside the Xcode app, so the most direct way to launch it is from within Xcode. You can also launch it indirectly via the Dock, Launchpad, or the command line.

Launch Instruments from Xcode

The most direct way to launch Instruments is via the Xcode menu in Xcode.

To launch Instruments from the Xcode menu
  1. Open Xcode.

  2. Choose Xcode > Open Developer Tool > Instruments.

    image: ../Art/xcode_instruments_menu_2x.png

You can also initiate Instruments in order to profile an app you are actively working on in Xcode.

To profile an opened Xcode project
  1. Launch Xcode and open your project.

  2. Do one of the following:

    • Choose Product > Profile.

      image: ../Art/xcode_product_profile_menu_2x.png
    • Click and hold the Run button in the Xcode toolbar and choose Profile.

      image: ../Art/xcode_toolbar_profile_menuitem_2x.png
    • Press Command-I.

Xcode builds your project, Instruments launches, and you’re prompted to select a profiling template.

If you need to profile your app with the same template regularly, you can set up your Xcode project to automatically use it whenever you initiate profiling.

To set up an Xcode project to use a specific Instruments profiling template
  1. Launch Xcode and open your project.

  2. Choose Product > Scheme > Edit Scheme.

    image: ../Art/xcode_product_scheme_edit_scheme_menu_2x.png

    Or, from the Scheme pop-up menu in the Xcode toolbar, choose Edit Scheme.

    image: ../Art/xcode_toolbar_target_edit_scheme_menu_2x.png

    Or, press Command–Less Than (<).

    The scheme editor dialog appears.

    image: ../Art/xcode_scheme_editor_dialog_2x.png
  3. Click Profile in the sidebar of the scheme editor dialog.

    image: ../Art/xcode_scheme_editor_profile_option_2x.png
  4. Under Info, click the Instrument pop-up menu and choose the desired profiling template.

    image: ../Art/xcode_scheme_editor_instrument_popup_2x.png

    If you chooseAsk on Launch, Instruments displays its profiling template selection dialog when it starts up.

  5. Click Close.

  6. Initiate profiling. See To profile an opened Xcode project.

Xcode builds your project, Instruments launches, and it begins profiling your app with the template you configured in the scheme editor.

Launch Instruments from the Dock

Instruments can be launched from the Xcode icon in the Dock.

To launch Instruments from the Xcode icon in the Dock
  1. Open Xcode.

  2. Control-click the Xcode icon in the Dock, and then choose Options > Open Developer Tool > Instruments from the shortcut menu.

    image: ../Art/dock_xcode_contextualmenu_instruments_2x.png

The Instruments app launches.

You can also add Instruments to your Dock for quick access. The quickest way to do this is to launch Instruments and then set it to stay in the Dock.

To permanently add Instruments to your Dock
  1. Open Xcode.

  2. Choose Xcode > Open Developer Tool > Instruments.

    image: ../Art/xcode_instruments_menu_2x.png

    Instruments launches and its icon appears in your Dock.

    image: ../Art/instruments_app_icon_small_2x.png
  3. Control-click the Instruments icon in the Dock, and then choose Options > Keep in Dock from the shortcut menu.

    image: ../Art/instruments_dock_contextual_menu_options_keepindock_2x.png

Launch Instruments from Launchpad

Launchpad automatically displays apps that reside in your Applications folder. Because Instruments isn’t in the Applications folder (at least, not directly—it’s in Xcode, which is in the Applications folder), it doesn’t appear in Launchpad. However, you can add it by creating an alias to Instruments and putting it in your Applications folder.

To add Instruments to Launchpad
  1. Open Xcode.

  2. Choose Xcode > Open Developer Tool > Instruments.

    image: ../Art/xcode_instruments_menu_2x.png

    Instruments launches and its icon appears in your Dock.

    image: ../Art/instruments_app_icon_small_2x.png
  3. Control-click the Instruments icon in the Dock, and then choose Options > Show in Finder from the shortcut menu.

    image: ../Art/instruments_dock_contextual_menu_options_2x.png
  4. Option-Command-drag the Instruments app icon in the Finder to your Applications folder.

    An alias of Instruments is created and added to your Applications folder.

  5. Remove the alias suffix from the filename of the Instruments alias.

    Instruments now appears in Launchpad.

    image: ../Art/launchpad_instruments_2x.png

Launch Instruments from the Command Line

You can use the open command to launch any app in OS X via Terminal.

To launch Instruments using the open command line tool
  1. Launch Terminal (in /Applications/Utilities/).

  2. Run the following command:

    open /Applications/Xcode.app/Contents/Applications/Instruments.app

The Instruments app launches.