How do you specify command line arguments in Xcode 4?

85,456

Solution 1

Command line arguments and environment variables can be set up in the Run section of the scheme editor.
Product -> Edit Scheme... -> Run -> Arguments (Copy-Paste from the link given by Jano)

Solution 2

The shortcut cmd + < works too. (Default shortcut)

On Xcode 7 (updated), XCode 10.1

Shortcut : Shift + cmd + <

Share:
85,456
Joshua Olson
Author by

Joshua Olson

Updated on July 21, 2022

Comments

  • Joshua Olson
    Joshua Olson almost 2 years

    I just upgraded to Xcode 4 and can't find much documentation on it yet, since it just went gold master. I need to specify a command line argument for testing my application.

    The Xcode 3.2 advice doesn't help since everything got moved around.

  • Gal Marom
    Gal Marom almost 10 years
    How do you get arguments explicit in a command line Xcode project? when you run it from the terminal
  • Sibbs Gambling
    Sibbs Gambling over 8 years
    (plus1, and thanks) This works, but really I have to go so deep to change parameters for each run?
  • donut
    donut over 8 years
    In Xcode 7.3 Beta 5: [Product > Scheme > Edit Scheme...]
  • user1398498
    user1398498 about 8 years
    If argument is a path to file or directory, full path should be given: /Users/MyUser/Documents/Folder/ , relative user directory path (~) is not resolved. It will work when run from command line though.
  • Alonso Urbano
    Alonso Urbano almost 8 years
    @SibbsGambling you just can do ⌘<