66

I'm trying to perform an install of a package with Homebrew, but when I try to run the install I am getting the following error:

Error: Your Xcode (7.3.1) is outdated. Please update to Xcode 8.0 (or delete it). Xcode can be updated from the App Store.

I would like to keep Xcode 7.3.1 on this machine since I have Xcode 8 on another machine, and am using this one for older projects.

I have found a similar post on SO, but the recommended solution to set export TRAVIS=1 doesn't seem to work for me. Hoping someone has a fix or a workaround I may use. Here are some more of my specifics:

Xcode 7.3.1
Homebrew 1.0.8-135-g4284b82
macOS Sierra 10.12 (16A323)

If anything other specifics needed, please let me know.

Thanks guys!

Geoherna
  • 3,523
  • 1
  • 24
  • 39
  • 2
    You can always have Xcode 7.3.1 **and** 8.0 on the same machine. You can switch the 'default' Xcode with the command line tool `xcode-select`. – Nicolas Miari Oct 28 '16 at 02:11
  • To keep older versions of Xcode, you need to explicityl download the DMGs form Apple website and install them manually. The copy of Xcode that was downloaded from the store becomes the "target for update" to the AppStore app, and is overwritten everytime you update from the store, as far as I know – Nicolas Miari Oct 28 '16 at 02:12
  • for those who might end up here, the `xcode-select --install` installed the command line tools and solved my problem. – Foad S. Farimani Nov 26 '18 at 22:10
  • Strangely enough I got this error again and my above solution did not help! so I ended up using [App Cleaner & Uninstaller](https://nektony.com/how-to/uninstall-xcode-on-mac) uninstalling xcode completely. – Foad S. Farimani Dec 14 '18 at 00:04

6 Answers6

85

So as @NicolasMiari mentioned in a comment above, the fix to my issue ended up having to have both Xcode 7 and Xcode 8 on my machine. I went on the apple developer site, downloaded Xcode 8, saved it to my documents and then used:

sudo xcode-select -switch ~/Documents/Xcode.app/

and then ran my brew install which worked as expected. Afterwards I ran:

sudo xcode-select -switch /Applications/Xcode.app/

to switch back to Xcode 7.3.1.

Hope this helps someone else, and thanks for the suggestions.

Geoherna
  • 3,523
  • 1
  • 24
  • 39
  • 1
    Hi, I had storage issue so I don't want to upgrade my Xcode. is it possible using brew without updating xcode? – Adiyat Mubarak Nov 03 '16 at 03:35
  • I haven't tried to use Homebrew without having Xcode installed, so I honestly am not sure the answer to that. Are you getting that error without having Xcode installed currently? – Geoherna Nov 03 '16 at 04:47
  • 1
    actually my problem is, my homebrew won't allow me to install something, and require me to upgrade my Xcode first. So i want to pass this warning that blocked me to install – Adiyat Mubarak Nov 03 '16 at 13:37
  • 4
    Faced the same issue today with Xcode 8.3.3 and Xcode 9.0 (beta), and this helped to resolve it - had to use `sudo xcode-select -switch /Applications/Xcode-beta.app/` for brew install to proceed – Mohan Noone Jun 21 '17 at 14:30
  • What should I do if I have only one Xcode 8 installed and it is too outdated? I don't want to delete the current Xcode, neither I want to install Xcode 9 – vahotm Oct 30 '17 at 15:53
  • 1
    Thanks, @georgeH ! This was driving me crazy for a while now. – sokeefe May 18 '18 at 20:10
  • To download older version of XCode from Apple, you have to sign into a Developer account in their Downloads section - https://developer.apple.com/download/more/?=xcode (linked from the [XCode Resources](https://developer.apple.com/xcode/resources/) page). – romellem Nov 21 '19 at 20:10
65

Just do as this

Open the file /usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb ,

then delete this line check_xcode_minimum_version in the following function.

def fatal_build_from_source_checks
    %w[
      check_xcode_license_approved
      check_xcode_minimum_version
      check_clt_minimum_version
      check_if_xcode_needs_clt_installed
    ].freeze
    end

Then brew install works fine.

Venkatachalam
  • 16,288
  • 9
  • 49
  • 77
jcccn
  • 827
  • 6
  • 6
  • I tried to comment it out by adding a `#` like `# check_xcode_minimum_version`, but that didn't work. Removing the line entirely (like you said) worked. – Ryan Sep 19 '21 at 14:02
  • 3
    You can also find the function (e.g. `def check_xcode_minimum_version`) and put a `return` in the beginning — easier to revert when done. – Gleb A. Dec 09 '21 at 22:11
  • 3
    Has to remove from `fatal_setup_build_environment_checks` too (not only from `fatal_build_from_source_checks`) – carla Jul 08 '22 at 17:57
5
  1. according to https://github.com/Homebrew/brew/issues/4957 outdated home-brew could cause this problem, brew update-reset fix it.

  2. if step 1 does not work, reinstall homebrew with /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Jichao
  • 40,341
  • 47
  • 125
  • 198
2

Renaming worked for me:

Xcode -> Xcode-old
Xcode-beta -> Xcode

Whitney Foster
  • 711
  • 11
  • 17
2

Two options:

  1. The best option is to update your xcode first, then follow @George H's recommendation above:

So as @NicolasMiari mentioned in a comment above, the fix to my issue ended up having to have both Xcode 7 and Xcode 8 on my machine. I went on the apple developer site, downloaded Xcode 8, saved it to my documents and then used:

sudo xcode-select -switch ~/Documents/Xcode.app/

and then ran my brew install which worked as expected. Afterwards I ran:

sudo xcode-select -switch /Applications/Xcode.app/

to switch back to Xcode 7.3.1.

  1. Set the xcode-select to the path of your CommandLineTools.

    sudo xcode-select --switch /Library/Developer/CommandLineTools
    

    As explained here, .Homebrew without Xcode

Both options work well.

Greenonline
  • 1,330
  • 8
  • 23
  • 31
Olusola Omosola
  • 847
  • 9
  • 9
-5

Run this code in terminal

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null

Then try running below code,

brew install jenkins

Hope this solves

surendher
  • 1,374
  • 3
  • 26
  • 52