Archive

Archive for the ‘Xcode’ Category

Finding the version number of the Xcode command line tools using the softwareupdate command

January 18, 2023 1 comment

As part of making sure your development environment is up to date, it’s often helpful to know what version of Xcode or the Xcode Command Line Tools that you’re using. For Xcode, this is relatively straightforward as you can check Xcode.app‘s version number or you can use the command shown below:


xcodebuild -version

view raw

gistfile1.txt

hosted with ❤ by GitHub

On a Mac running Xcode, running that command should provide output similar to what’s shown below:


username@computername ~ % xcodebuild -version
Xcode 14.2
Build version 14C18
username@computername ~ %

view raw

gistfile1.txt

hosted with ❤ by GitHub

However, for the Xcode Command Line Tools, this process isn’t as straightforward. There isn’t a specific app to check for version information and running the command above results in the following output:


username@computername ~ % xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
username@computername ~ %

view raw

gistfile1.txt

hosted with ❤ by GitHub

So how can you determine the latest installed version of the Xcode Command Line Tools? One way is to use the softwareupdate command’s history function, which should show all of the versions of the Xcode Command Line Tools which have been installed. You can use the following command to display all the installations of the Xcode Command Line Tools:


softwareupdate –history | grep "Command Line Tools for Xcode"

view raw

gistfile1.txt

hosted with ❤ by GitHub

For example, since both Xcode Command Line Tools 12 and Xcode Command Line Tools 13 are available for macOS Big Sur 11.7.x, you may see output similar to what’s shown below on a Mac running Big Sur:


username@computername ~ % softwareupdate –history | grep "Command Line Tools for Xcode"
Command Line Tools for Xcode 12.5 09/21/2022, 15:04:54
Command Line Tools for Xcode 13.2 01/17/2023, 11:18:19
username@computername ~ %

view raw

gistfile1.txt

hosted with ❤ by GitHub

Since the latest installed version of the Xcode Command Line Tools should be listed at the bottom of the output from the softwareupdate command’s history function, you should be able to use the following command to get the version number of the latest installed version of the Xcode Command Line Tools:


softwareupdate –history | awk '/Command Line Tools for Xcode/ {print $6}' | tail -1

view raw

gistfile1.txt

hosted with ❤ by GitHub

As of the date of this post, the latest version of the Xcode Command Line Tools on macOS Ventura 13.1 is version 14.2, so you should see output similar to what’s shown below on a fully updated macOS 13.1 Mac running the latest version of the Xcode command line tools:


username@computername ~ % softwareupdate –history | awk '/Command Line Tools for Xcode/ {print $6}' | tail -1
14.2
username@computername ~ %

view raw

gistfile1.txt

hosted with ❤ by GitHub

Notarizing Automator applications

April 10, 2019 11 comments

Apple recently updated their notarization documentation to include this note:

Beginning in macOS 10.14.5, all new or updated kernel extensions and all software from developers new to distributing with Developer ID must be notarized in order to run. In a future version of macOS, notarization will be required by default for all software.

Screen Shot 2019 04 10 at 4 03 43 PM

The part about “notarization will be required by default for all software” made me think, because there are a few apps that I’ve written over the years that are still useful (at least to me). All of them were built using Automator, which meant that the usual Xcode-based ways of notarizing applications wasn’t going to work for me.

With assistance by folks in the MacAdmins Slack though, I was able to develop a process that allowed me to do the following:

  1. Codesign an Automator application
  2. Upload the application to Apple for notarization
  3. Attach the notarization to the application
  4. Verify that the notarization was attached and valid.

The documentation linked below was also very helpful in figuring out how to notarize using command line tools:

For more details, please see below the jump.

Read more…

Updated Xcode command line tools installer script now available

June 10, 2018 1 comment

A while back, I developed a script that will download and install the Xcode Command Line Tools on Macs running 10.7.x and higher.

Most of the time it works fine. However, starting with macOS Sierra and continuing on with macOS High Sierra, I occasionally ran into an odd problem. Apple would sometimes have both the latest available Xcode Command Line Tools installer and the just-previous version available on Apple’s Software Update feed.

Screen Shot 2018 06 09 at 12 11 06 PM

The original script was written with the assumption that there would only be one qualifying Xcode Command Line Tools install option available at any one time. When more than one is available, the script isn’t able to correctly identify which Xcode Command Line Tools it should be installing. The result is that the script ends without installing anything.

Apple usually removes the previous version from the Software Update feed within a few days, which allows the script to work normally again. But when it happened this time, I decided to update the script to hopefully fix this issue once and for all. For more details, please see below the jump.

Read more…

Installing the Xcode command line tools on 10.7.x and later

February 2, 2015 6 comments

A number of Mac admins need to provide the Xcode Command Line Tools for the Macs in their environments, either as part of building machines or afterwards. To help with this task, I’ve developed a script that will download and install the Xcode Command Line Tools on Macs running 10.7.x and higher. See below the jump for more details.

Read more…

Building a Grand Unified Xcode 5.0.2 installer for Mavericks and Mountain Lion

November 17, 2013 4 comments

Apple has released Xcode 5.0.2 through the Mac App Store for all Macs running 10.8.4 and higher. While the command line tools for Mavericks are now included with Xcode, the command line tools for Mountain Lion can be installed separately through the Xcode preferences, in the Downloads section.

For my users who are developers, Xcode is part of their their new machine builds. I wanted to include Xcode 5.0.2 and also, where appropriate, install the command line tools automatically without needing to enter an Apple ID. With a little help from the Mac App Store, I was able to do this using Packages. See below the jump for the details.

Read more…

Xcode Command Line Tools included with Xcode 5.0.x on Mavericks

November 15, 2013 2 comments

Something I’ve always tried to include with Xcode installations are the Xcode command line tools. Starting in Xcode 4.3, Apple stopped bundling these tools by default and instead made them an optional install.

Since having these tools is useful, I re-packaged various versions of Xcode so that I could include these tools as part of the install. One of the ways I could tell that they were installed was by going into Xcode’s Downloads preferences panel and see if the Command Line Tools showed up with a checkbox entry.

Screen Shot 2013-11-15 at 1.13.40 PM

Starting in Mavericks though, the Command Line Tools entry disappeared from Downloads.

Screen Shot 2013-11-15 at 12.58.10 PM

Meanwhile, the Xcode command line tools themselves moved. In Mountain Lion, the Xcode 5.0.x command line tools are installed into /usr/bin and other system software directories.

Screen Shot 2013-11-15 at 1.29.57 PM

In Mavericks, they are installed into /Library/Developer.

Screen Shot 2013-11-15 at 11.19.41 AM

Why was this happening? After some digging and some collaborative work in the ##osx-server IRC room, an answer was found. See below the jump for details.

Read more…

Building a Grand Unified Xcode 5.0.1 installer for Mavericks and Mountain Lion

October 24, 2013 8 comments

Apple has released Xcode 5.0.1 through the Mac App Store for all Macs running 10.8.4 and higher. The command line tools can be installed separately through the Xcode preferences, in the Downloads section.

For my users who are developers, I wanted to include Xcode 5.0.1 in their new machine builds and also install the command line tools automatically without needing to enter an Apple ID. I also wanted to build this installer as a flat package, so I’m shifting from my previous method using Iceberg to using Packages to build the installer package. With a little help from the Mac App Store, I was able to do this. See below the jump for the details.

Read more…

Building a Grand Unified Xcode 5.0 installer for Mountain Lion

September 20, 2013 14 comments

Apple has released Xcode 5.0 through the Mac App Store for all Macs running 10.8.4 and higher. The command line tools can be installed separately through the Xcode preferences, in the Downloads section. You now need an Apple Developer Connection account to install the Xcode 5 command line tools via the Xcode preferences, though a free ADC membership is sufficient.

For my users who are developers, I wanted to include Xcode 5.0 in their new machine builds and also install the command line tools automatically without needing to enter an Apple ID. I also wanted to build this installer as a flat package, so I’m shifting from my previous method using Iceberg to using Packages to build the installer package. See below the jump for the details.

Read more…

Building a Grand Unified Xcode 4.4 installer for both Lion and Mountain Lion

July 26, 2012 13 comments

Apple has released Xcode 4.4 through the Mac App Store for all Macs running 10.7.4 and higher, including Mountain Lion. This application, on first launch, then installs the other Xcode tools. The command line tools can be installed separately through the Xcode preferences, in the Downloads section.

Screen Shot 2012-07-26 at 11.41.12 AM

For my users who are developers, I wanted to include Xcode 4.4 in their new machine builds and also install the command line tools automatically. I also wanted to build one Xcode 4.4 installer that worked for both 10.7.x and 10.8.x. The Xcode 4.4 application itself runs fine on both Lion and Mountain Lion, but the command line tools are OS-specific.

To do this, I used a modified form of the methodology referenced in this post to repackage Xcode 4.4 for distribution without needing an Apple ID. See below the jump for the procedure.

Read more…

Changing Keychain Minder’s displayed text using Xcode

June 5, 2012 Leave a comment

I was recently asked about my organization’s Keychain Minder application, as I had altered the displayed text to better meet my organization’s needs.

Screen Shot 2012-06-05 at 4.32.30 PM

For those who also want to do this for their own organization, see below the jump for the procedure I’ve used.

Read more…

Categories: Mac administration, Xcode