Tag Archives: Xcode

How to fix “active developer path does not exist” with git on macOS

I’ve recently removed Xcode from my ageing MacBook. Ever since then, I’m getting an error when I try to run git from the command line. The error goes something like this:

That’s because Xcode had installed several command line tools provided by Apple, and one of them was Git. I thought simply installing it via Homebrew would do the trick but alas that too brings up an error message, albeit a different one. Somewhat frustrated, I was wondering how I was ever going to run Git from the command line again.

I did some testing and found a fix to this issue. Here’s what worked for me.

Turns out that I had a symbolic link (or rather a stub) at /usr/bin/git, a place at which git might indeed be expected to live. This however redirected to a no longer existent Xcode installation, or more precisely the xcrun command. All I had to do was rename the symbolic link with admin privileges:

Once that was taken care of, I could download the macOS installer from the official Git-SCM website. I found it under Downloads (it’s not the GUI version, just the command line version at the top of the page). It’s a .pkg file that will install git to /usr/local/git, and places symlinks into /usr/local/bin and /usr/share/man/.

Lo and behold, after the quick and painless installation, I could simply type git from the command line and the above error was gone, and git was operational again.

How to use Xcode for C and C++ development

Not only is Xcode an excellent IDE for iOS and macOS apps in both Swift and Objective-C; it does just as fine a job for regular C and C++ code. This includes all the features we know and love, such as code completion, version control, and all the rest of it.

Let’s see how to use Xcode 8.3 for C and C++ development.

A Chinese Version of this article can be found here.

Continue reading How to use Xcode for C and C++ development

How to change a UIStoryboard from iPhone to iPad in Xcode 5

In this screencast I’ll show you how to make an iPhone storyboard display as an iPad storyboard in Xcode 5.1’s Interface Builder. Under the hood a UIStoryboard is just an XML file, and with a small tweak we can make Xcode display it like an iPad or an iPhone. This is a good strategy if you’d like to use your iPhone storyboard as a starting point for an iPad version.

You can read my full article on my iOS Dev Diary:

How to populate an NSTableView in Code

In this screencast I’ll show you how to power an NSTableView using code. I’m referencing this article for code snippets and details: http://pinkstone.co.uk/how-to-populate-an-nstableview-in-code/

I’ve also made a “no-code” version on how to populate an NSTableView using an Array Controler and Cocoa Bindings here: http://pinkstone.co.uk/how-to-bind-an-nsarraycontroller-to-an-nstableview/


How to bind an Array Controller to a Table View with Cocoa Bindings

In this screencast I will show you how to bind a Table View to an Array Controller in Cocoa, using Xcode 5.1 and OS X Mavericks. We’re using Core Data to save our entries and – check it out – we’re not writing a single line of code!

Cocoa Bindings is one of the most exciting features in OS X development for me, and I hope that one day it’ll find its way into iOS too.

The project is also available on GitHub: https://github.com/versluis/Bindings-Demo

I’ve written more about how to do this here: http://pinkstone.co.uk/binding-an-nstableview-to-core-data-without-code/

How to Tear Down your Core Data Stack in iOS

In this screencast I will show you how to tear down your Core Data Stack. Documentation on this topic is a little sketchy to say the least.

We’ll create a new Master/Detail app and implement a button that will remove the store file and reset the entire stack – without nasty error messages or app crashes. The app will work on iOS 7.1 and iOS 6. I’m using Xcode 5.1 in this demo. The principles of course apply just as much to Mac Development.

You can read more in my companion article here: http://pinkstone.co.uk/how-to-tear-down-your-core-data-stack/

There’s also a GitHub project that shows the full app (find the link in the same article).


How to use Branches in Xcode

In this video I will show you how to use the Git Branch feature in Xcode 5.1.

Branches are helpful if you’re developing your app. You can isolate a “working” version, create a new branch and fiddle with new features that may destabilise your project. You can then commit your changes – working or not – to a separate branch, and when all is stable again you can merge them back into the master project.

I use this feature for plugin and theme development, in fact for any “group of files” that will change over time. If you’re not using Xcode, take a look at the GitHub Apps which are available for Mac and Windows. They make version control a breeze on your local system, integrate flawlessly with GitHub.com as well as SSH remotes on your own server.

How to use Git Tags in Xcode

In this video I will show you how to make use of Tags in Git. This is not supported in Xcode or GitHub for Mac at the time of this recording (April 2014). I will also show you how to utilise the Tag/Release feature on GitHub.com.

Tags are a useful feature if you want to mark versions of your software before you add new features. With Tags you can always go back to the code of a release.

We’re using Xcode 5.1 and the Terminal utility for this.

I use tags and branches for plugin and theme development too, in fact for any “group of files” that will change over time. If you’re not using Xcode, take a look at the GitHub Apps which are available for Mac and Windows. They make version control a breeze on your local system, integrate flawlessly with GitHub.com as well as SSH remotes on your own server.

How to fix “No unexpired provisioning profiles found that contain any of the keychain’s signing certificates” in Xcode 4

I understand there can be many reasons for this error message. Xcode needs a distribution profile with the same Bundle Identifier as the app. Even though this seemed to have worked in the past, Xcode 4.6.3 has gotten more pernickety as of late.

Let’s fix this.

Provisioning Portal

Head over to the Apple Provisioning Portal and under Provisioning Profiles, select Distribution.

Screen Shot 2013-09-15 at 11.51.44

Select the Plus Button to add a new profile. Select App Store under Distribution and hit continue.

Screen Shot 2013-09-15 at 11.53.50

Next you’ll have to select the App ID for your project. Once selected, hit continue and give your new Distribution Profile a name (I’d use the name of your app). You’ll pre prompted to download the profile on the next screen.

Note that this isn’t necessary as Xcode can import those automatically – let’s do that next.

Back in Xcode 4.6.3

Open the Organiser (under Window) and select Devices. Under Library, find Provisioning Profiles and see a (probably very long) list of currently installed profiles. At the bottom right of that screen there’s a Refresh button – click that and Xcode will talk to the Provisioning Portal, importing and updating all profiles in this list. Your new one should have been added to the list after a few seconds.

Now quit Xcode and restart it

This is crucial for the automatic profile selector to refresh – otherwise your new profile won’t show up for selection. Don’t ask! I’m sure it’ll all be “so much better in Xcode 5″ (yeah right). Anyway…

Select your project’s Big Blue Bar (I’m not sure what it’s called, the one above the target) and select Build Settings. In here, find the Code Signing section – you can search for it at the top right or just scroll down. The block you’re looking for looks like this:

Screen Shot 2013-09-15 at 12.05.46

Select your Developer Profile for the first two options, and your newly created Distribution Profile (with matching Bundle ID) for the latter two, just like in the screenshot.

Head over to Product – Build and with a bit of luck the error should have gone.