22

Apple has recently released Command Line Tools:

  1. What are the tools provided in the Command Line Tools package?

  2. Is there some sort of documentation other than man pages?

Please note that I have installed these tools by adding the specific component in Xcode. Also, this is not about a Xcode project, but a package released by Apple on February 16, 2012!

Richard Slater
  • 6,313
  • 4
  • 53
  • 81
Alerty
  • 5,945
  • 7
  • 38
  • 62
  • I would imagine they should be available form the command line then as per usual. Usuaully they get installed to `/usr/bin` or symlinked there. At least thats how its been in the past. Now that they arent bundled in the install by default im not sure what the install location is. – prodigitalson Feb 18 '12 at 19:00
  • This is just a subset of dev tools with GCC and headers for compiling software as well as build tools that might not be on they system by default like make llvm, etc.. You used to have to install Xcode in full to get the stuff, now its been split out to a separate component mpkg which is super convenient for those of use Homebrew or Macports but dont actually need XCode. What exactly are you trying to find/use? IF you already have Xcode installed you should already have this stuff. – prodigitalson Feb 19 '12 at 02:46
  • 2
    i dunno about creating a project but to build you would do `xcodebuild`, there is `xcodeindex` which indexes a project folder. and `xcode-select` which selects the the location of the Xcode folder (presumably if you have multiple versions of xcode or multiple versions of related tools). If you do `man xcode-select` youll see a number of additional tools which are related listed at the end. You can then do `man` for any of these other tools for usage. – prodigitalson Feb 19 '12 at 04:12
  • Actually, you may want to wait some days until Apple fixes the package, since the one they presently have in their page, gives an **invalid checksum** when opening. The same goes if you try an install it trough Xcode download preferences menu. – jbssm Feb 19 '12 at 11:12
  • @jbssm: Personally, I haven't encountered any trouble with downloading and installing the package. My problem is that I do not know the name of these tools and I cannot locate them because of the lack of documentation. – Alerty Feb 19 '12 at 20:19

2 Answers2

12

Open the command line tools DMG and you'll find a meta-package, which you can extract with the command pkgutil --expand 'Command Line Tools.mpkg' metapackage. Open the metapackage/Distribution file that was just extracted in a text editor to see the packages that comprise the meta-package:

com.apple.pkg.DevSDK
com.apple.pkg.X11SDK
com.apple.pkg.QuickTimeSDK
com.apple.pkg.OpenGLSDK
com.apple.pkg.WebKitSDK
com.apple.pkg.FireWireSDK
com.apple.pkg.BluetoothSDK
com.apple.pkg.CoreAudioSDK
com.apple.pkg.JavaSDK
com.apple.pkg.clang
com.apple.pkg.llvm-gcc4.2
com.apple.pkg.X11Documentation
com.apple.pkg.DeveloperToolsCLI

The corresponding package files are found in a hidden Packages directory alongside the metapackage. Their contents can be listed with pkgutil --payload-files.

If you have a file on disk, and want to know which package it came from:

$ pkgutil --file-info /usr/bin/clang
volume: /
path: /usr/bin/clang

pkgid: com.apple.pkg.clang
pkg-version: 4.3.0.0.1.1249367152
install-time: 1342021874
uid: 0
gid: 0
mode: 755

Now, some bonus information that will be useful if you ever want to remove the command-line tools. Apple, in their infinite wisdom, decline to provide a tool to do so, but we can obtain the information we need by using pkgutil to display information about installed packages.

Firstly, pkgutil --pkgs will list all installed packages. Compare the output of the list of packages above.

pkgutil --info will display information about an installed package; for example:

$ pkgutil --info com.apple.pkg.clang
package-id: com.apple.pkg.clang
version: 4.3.0.0.1.1249367152
volume: /
location: /
install-time: 1342021874
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group

pkgutil --files will display the contents of an installed package, relative to the volume and location fields given by pkgutil --info. Because the absolute paths are not used, you can't simply pipe the output of this command to xargs rm -f to remove a package's files; you'll have to fix up the paths yourself, perhaps with something like pkgutil --files com.example.pkgname | while read line; do rm -f "/install_location/$line"; done.

Once a package's files are removed, pkgutil --forget should be run to remove information about the installed package from the package database.

It should go without saying that you should be very careful if you try this: you're one typo away from screwing your system up so badly that you'll have to reinstall it, to say nothing of your precious data!

pkgutil has some other useful options for verifying that a package's files are all present, and for restoring their permissions; see its manual page for the details.

In general, this will work for any package, however note that some packages can have embedded scripts that get run when the package is installed; obviously, merely removing the package's files won't remove all traces of the package from your system. You'll have to extract the package's contents and read the script source code, and then decide how best to undo the effects of the script yourself.

Sam Morris
  • 1,858
  • 1
  • 17
  • 18
1

I had a similar problem: I couldn't run "make" after upgrading to Xcode 4.3. To fix it, I just set my PATH variable to include:

/Applications/Xcode.app/Contents/Developer/usr/bin
/Applications/Xcode.app/Contents/Developer/Tools

Once I had that set up, replacing my old PATH entries referring to /Developer, I could run a "make" from the command line again.

S2VpdGgA
  • 69
  • 4
  • 2
    This is not about running 'make' in the command line... I want these tools listed with appropriate documentation as well as a way of creating xcode projects from the command line. – Alerty Apr 18 '12 at 23:17
  • I had looked into generating the *.xcodeproj folders from the command line but I ended up just creating a new project from within Xcode. The command to build the project is: `xcodebuild -configuration Debug` for the debug version (obviously) and `xcodebuild -configuration Release` for the release version. As for documentation, the best I can give you is `man xcodebuild`. – S2VpdGgA Apr 19 '12 at 12:50
  • That is the thing though there is no command line tool from Apple, to my knowledge, that creates a xcode project. In order to build a project, you need a project file. – Alerty Apr 19 '12 at 15:30
  • Alerty, you could look at the [xcodeproj](https://github.com/CocoaPods/xcodeproj) ruby library – orta Oct 02 '12 at 11:47
  • The questions is not about XCode but just parts of it, ie. the command-line tools. – Petri May 06 '13 at 09:20