XCode 4.3 Command Line Tools [closed] XCode 4.3 Command Line Tools [closed] xcode xcode

XCode 4.3 Command Line Tools [closed]


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.DevSDKcom.apple.pkg.X11SDKcom.apple.pkg.QuickTimeSDKcom.apple.pkg.OpenGLSDKcom.apple.pkg.WebKitSDKcom.apple.pkg.FireWireSDKcom.apple.pkg.BluetoothSDKcom.apple.pkg.CoreAudioSDKcom.apple.pkg.JavaSDKcom.apple.pkg.clangcom.apple.pkg.llvm-gcc4.2com.apple.pkg.X11Documentationcom.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/clangvolume: /path: /usr/bin/clangpkgid: com.apple.pkg.clangpkg-version: 4.3.0.0.1.1249367152install-time: 1342021874uid: 0gid: 0mode: 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.clangpackage-id: com.apple.pkg.clangversion: 4.3.0.0.1.1249367152volume: /location: /install-time: 1342021874groups: 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.


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.