Homebrew Xcode



If, like me, you tried installing imagemagick or other software using Homebrew, you might have ran into this error:

  1. Homebrew Xcode Command Line Tools
  2. Homebrew Xcode Outdated
  3. Homebrew List Installed Packages
  4. How To Install Homebrew On Mac
  5. Homebrew Xcode

This took me one day to fix, because usually everyone tells you to run xcode-select --install. This does not fix the problem.

Why this happens

Run Xcode and accept the license! Homebrew can not install properly until this occurs. Install Homebrew. If this is not a fresh install of Homebrew, go ahead and purge the complete installation first. Brew / Library / Homebrew / os / mac / xcode.rb / Jump to Code definitions OS Module Mac Module Xcode Module latestversion Method minimumversion Method belowminimumversion?

Mac OS X 10.14 has stopped placing the include libraries in their usual location, /usr/include, keeping them only inside the XCode directory.

To confirm that this is the problem, simply run ls /usr/include. If the result comes out empty, its really this problem.

By running find / | grep libxml/parser.h I can find the libxml library in several places:

SoftwareHomebrew

What you should not do

Some would say that you should just link the path where the libraries are to /usr/include. This is not right, as it overrides the default behaviour expected by Mac OS and requires you to disable SIP (System Integrity Protection). Sometimes it is needed, but this is not one of those times. Leave csrutil alone.

Homebrew

You CANNOT modify /usr/include, even with the root user. It is locked by SIP, so if you try you will get a Operation not permitted error.

What worked for me

Apple ships a “legacy installer” for you to be able to install the headers in the “old location”. Run this:

Homebrew Xcode Command Line Tools

Then, the installer will be placed at your Destop. Simple double-click and it will install the headers in /usr/include.

or, if you want a pure command line alternative:

Problem fixed

The /usr/include directory now includes all the libraries required by brew to link during package compilation:

Now imagemagick and other kegs will install successfully.

Recently I was cleaning up the disk space of my MacBook Air. I realize that Xcode takes up around 10G space and I’m not doing any iOS/macOS development. I know that the only thing I need from Xcode is its command line tools for homebrew. Therefore, I would like to uninstall Xcode while keeping the command line tools.

Remove the Xcode application

First thing to do is to remove the Xcode.app located in ~/Applicationswhich is taking up a huge amount of space. This is pretty easy, just move it to trash and empty your trash.

Homebrew Xcode Outdated

Update Xcode’s path

Homebrew List Installed Packages

After you remove the Xcode.app, your homebrew will have trouble finding all the command binaries. Therefore, we need to update the Xcode path to point it to the actual directory for command line tools. Use the following command (tested on macOS Sierra)

After you change the path, homebrew should be able to find all the binaries provided by the command line tools.

Test Homebrew

How To Install Homebrew On Mac

Aws d1 1 visual inspection acceptance criteria. To make sure everything is working, run brew doctor to check if there is any error. If brew doctor reports nothing and says you are ready to brew, then you are good to go!

Please enable JavaScript to view the comments powered by Disqus.comments powered by

Homebrew Xcode

Disqus