SaRaVaNaN DM
SaRaVaNaN DM

Reputation: 4410

how to get bundle id of commandline tool

I have created a command line tool long back using Xcode6.2. Now i forgot that tool bundle identifier, is there a way to get cmdline tool identifier from the built binary?

In xcode6.2 there is no such option to view the bundle identifier of cmdline tool.

Upvotes: 1

Views: 4502

Answers (2)

Ken Thomases
Ken Thomases

Reputation: 90571

If the command-line tool has an embedded Info.plist, which is not typical, you can view it using:

otool -P <path to executable>

The bundle ID would be one of the keys in that Info.plist.

Other than an embedded Info.plist, stand-alone binaries don't really have bundle IDs.

Upvotes: 4

Vatsal
Vatsal

Reputation: 18181

Answer: You can't. Err... kinda.

A command line tool does not have a bundle identifier by default. For what it's worth, you can try looking at the PRODUCT_BUNDLE_IDENTIFIER setting in Build Settings.

However, if you're asking about obtaining the bundle identifier at runtime (provided you have an Info.plist file being embedded, as noted by @trojanfoe in the comments), you can obtain it via:

[NSBundle mainBundle].bundleIdentifier 

Upvotes: 0

Related Questions