How do you install Xcode and the Command Line Tools on Yosemite? - xcode

I followed the instructions here:
http://quantgreeks.com/how-to-install-xcode-command-line-tools-in-osx-yosemite/
However, I didn't fit the exact requirements for that tutorial because I never installed Xcode before. In addition, I had trouble figuring out how to download Xcode. I ended up at the App Store, where it said my Developer account had been suspended for security reasons--but I can log in fine in the Apple Developer area. I ended up here:
https://developer.apple.com/devcenter/mac/index.action
where I clicked on View all downloads, and then I downloaded the Xcode 6.2 dmg file. Then I clicked on the dmg file, and the installer had me drag the Xcode icon onto a folder icon.
I followed the rest of the steps in the tutorial, and at the end of the tutorial, it says to test your install like this:
$ xcode-select -p
/Library/Developer/CommandLineTools
However, I get the output:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
I do have the following directory:
/Library/Developer/CommandLineTools
My conclusions:
1) In tutorials, make sure you pay attention to the distinction between the phrases the Full Xcode Package and the the Xcode Command Line Tools.
2) If you install the Full Xcode Package, and then you test the installation I think this might be the correct output:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
3) If you install just the Xcode Command Line Tools, and then you test the installation, then this might be the correct output:
$ xcode-select -p
/Library/Developer/CommandLineTools

I follow this link to detect and install the Xcode command line tools.
Here is the main command it sounds like you need to follow after verifying the full Xcode package is installed.
xcode-select --install

I follow this link to install the Xcode command line tools.
You can choose your command line tools depending on your OS X
for example for me I have OS X 10.8.5 I go to command_line_tools_for_osx_mountain_lion_april_2014

Related

How to switch command line tools on MacOS

I installed two commmand line tools on my mac.
So I want to switch command line tools.
How I can do it?
I tried switch from Xcode preferences > Locations > Command line tools.
However, Command line tools beta 1 for Xcode 10 is not appear on this menu.
Xcode 9.4 is installed on my mac.
macOS 10.13.5
Xcode 9.4 command line tools (bundled with Xcode9.4, it installed at /Applications/Xcode.app/Contents/Developer)
Command line tools beta1 for Xcode 10 (not bundled with Xcode, it installed at /Library/Developer)
Use this command in terminal to switch xcode:
sudo xcode-select -s /Applications/Xcode-beta.app
See: https://medium.com/#maximbilan/switch-command-line-tools-to-xcode-beta-2e99c54cb147
call Xcode.app like this:
sudo xcode-select -s /Applications/Xcode.app
if you're downgrading from Xcode Beta version
You can use .bash_profile to add alias to switch 2 versions:
alias Xcode13='sudo xcode-select -s /Applications/Xcode\ 13.app'
alias Xcode14='sudo xcode-select -s /Applications/Xcode.app'
Most important:
use source ~/.bash_profile to make the command effective.
Then, input Xcode14 to switch the Xcode version.
For normal versions
Execute on the terminal the following code:
xcode-select --install
For beta versions
Once you have install your xcode-beta.
Install your commands line tools like usual, using the following code on your terminal
xcode-select --install
One you have installed commands line tools is the step to download the new ones
To do this, open your browser and look for apple developer resources download
Select view additional downloads, you will need to logIn in order to continue.
Once you have logIn, look for the file you are interested in, in my case was Additional Tools for Xcode 14 beta 5
Select download and wait.
Once is downloaded if you try to open it, you will see the following content on the folder.
It is time to open xcode
Look for xcode<preferences
Search for Locations.
And on command line tools select the ones you just downloaded
I have install 2 Xcode version 10, 11 and can switch them. But both of them have install on Applications.
- Applications/Xcode.app
- Applications/Xcode 10/Xcode.app
May be you should move it to Applications inside folder like me.

Xcode installing on mac

I am new to mac and I want to install Xcode. I have macOS Sierra Version 10.12.2. I found online that I have to run in terminal:
xcode-select --install
I did that but I get this:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
However, I can't find it in Application folder or with Spotlight Search and there is no Software Update to be done. Also, I found online that I have to download it from App Store and I am a bit confused. I can install it from terminal (and if so, why is it not working) or I have to download it from App Store?
Thank you!
xcode-select: error: command line tools are already installed, use
"Software Update" to install updates
It shows that your operating system has already installed xcode-select.
Finding your xcode-select. Go to Terminal and type
xcode-select --print-path
It shall return the location of your xcode-select to you:
/Library/Developer/CommandLineTools
Xcode: develop an app for Apple products
xcode-select: command-line tool
Depending on what you want to do with Xcode, xcode-select is way smaller than it, 8.1GB vs. nothing.
2018 and I had the same issue. Installing XCODE from the App Store did not resolve this.
I Had to download the command line tools for my XCODE and Apple Version.
https://developer.apple.com/download/more/
Searched for XCODE on that page above and picked the right version for me.
After installation of the DMG I could continue with Brew Installation.
You don't install Xcode from terminal, you have to go to develloper.apple.com in order to download the latest versions. Here's the link to save you some time:
Link to Xcode
Plus the version available depends on what Mac Osx version you have.
Was having the same issue after some system update, cannot even run things like make install.
verify your path by xcode-select --print-path, which might be /Applications/Xcode.app/Contents/Developer(need to be updated at last)
go to apple develper site, login, search command line tools, download the latest dmg, install. (better option than the 10+GB Xcode)
now update the path in step 1 by running sudo xcode-select --switch /Library/Developer/CommandLineTools.
verify again by running the xcode-select --print-path.
Now it should be good to go.

installing qt on macOS Sierra [duplicate]

I just installed Qt 5.5 and am using Qt Creator for the first time on OS X. When I first installed Qt, it gave me an error message 'Xcode 5 not installed' which I thought was strange, (I have the Xcode 7 beta), but the install completed successfully anyways.
Now, when I start or open a project, I get the error:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
When I run /usr/bin/xcodebuild in Terminal, I get the following:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
I'm not sure what Xcode has to do with Qt Creator, unless it has something to do with accessing libraries for cross-platform compatibility, but is there a way to fix this issue?
>= Xcode 8
In Xcode 8, as Bruce said, this happens when Qt tries to find xcrun when it should be looking for xcodebuild.
Open the file:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
Replace:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
With:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
~> Xcode 8
Before Xcode 8, this problem occurs when command line tools are installed after Xcode is installed. What happens is the Xcode-select developer directory gets pointed to /Library/Developer/CommandLineTools.
Point Xcode-select to the correct Xcode Developer directory with the command:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Confirm the license agreement with the command:
sudo xcodebuild -license
This will prompt you to read through the license agreement.
Enter agree to accept the terms.
If you change content of Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
then it will work only for Desktop kit, not for ex. simulator.
A better way is just to create symlink:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
so you don't have to change .prf files for all targets.
This will do the trick:
#sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Run this in your terminal.
For users of Xcode 8, there is another problem. See here for a temporary solution until Qt 5.7.1 is released:
https://forum.qt.io/topic/71119/project-error-xcode-not-set-up-properly
To summarise:
Open Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf in a text editor, and replace this:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))))
with this:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
If you build Qt from source with XCode 8.x, you have to change the "-find" argument in the file qt-everywhere-enterprise-src-5.7.0/qtbase/configure on line 551 so that it looks like:
if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then
Managed to solve it installing the full version of Xcode, agreeing to the terms, then using xcode-select --reset.
Basically the problem is that the xcode you're pointing at /Library/Developer/CommandLineTools doesn't allow you to accept the terms & conditions. So after the install & resetting the location, all should be OK
For me, the only way to work correctly is to commenting the lines about xcrun with the '#':
# Make sure Xcode is set up properly
#isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
#error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
At the file: Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
Just to add a bit to a lot of old answers in the spirit of "This worked for me"
I found that by launching Xcode, logging in to my developer account (just a free one) and then setting the Command tools in "Locations".
I could get the
'sudo /usr/bin/xcodebuild -license agree'
to work. i.e. it launched an agree process in the command line and I agreed after careful reading of all 14 squillion pages of stuff.
I did not have to edit anything.
My system is Mojave 10.14.6 and Xcode 10.3 (10G8).

How can I find out if I have Xcode commandline tools installed?

I need to use gdb.
ps-MacBook-Air:AcoustoExport pi$ gdb
-bash: gdb: command not found
ps-MacBook-Air:AcoustoExport pi$ sudo find / -iname "*gdb*"
Password:
/usr/local/share/gdb
/usr/local/Cellar/isl/0.12.1/share/gdb
:
and:
ps-MacBook-Air:AcoustoExport pi$ ls -la /usr/local/share/gdb
lrwxr-xr-x 1 pi admin 30 14 Jan 22:01 gdb -> ../Cellar/isl/0.12.1/share/gdb
Not quite sure what to make this, clearly it is something installed by homebrew. I don't know why it's there, I don't know whether I could use it instead. It isn't in the search path.
So I figure I need Xcode commandline tools.
Xcode is not currently available from the Software Update server
^ my current problem exactly. Comment on that question says "you can get this error if you have them already"
But how do I check whether I have them already?
/usr/bin/xcodebuild -version
will give you the xcode version, run it via Terminal command
This command allows you to retrieve Xcode version when having only the CommandLineTools version installed:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
As per this answer to "Determine xcode command line tools version" on Ask Different
Notes:
Confirmed working on maxOS Sierra and Big Sur.
When only CommandLineTools is install without Xcode, using xcodebuild returns the following error:
# /usr/bin/xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
First of all, be sure that you have downloaded it or not. Open up your terminal application, and enter $ gcc if you have not installed it you will get an alert. You can verify that you have installed it by
$ xcode-select -p
/Library/Developer/CommandLineTools
And to be sure then enter $ gcc --version
You can read more about the process here: Xcode command line tools for Mavericks
if you want to know the install version of Xcode as well as Swift
language current version:
Use below simple command by using Terminal:
1. To get install Xcode Version
xcodebuild -version
2. To get install Swift language Version
swift --version
Thanks to the folks on Freenode's #macdev, here is some information:
In the old days before Xcode was on the app-store, it included commandline tools.
Now you get it from the store, and with this new mechanism it can't install extra things outside of the Xcode.app, so you have to manually do it yourself, by:
xcode-select --install
On Xcode 4.x you can check to see if they are installed from within the Xcode
UI:
On Xcode 5.x it is now here:
My problem of finding gcc/gdb is that they have been superseded by clang/lldb: GDB missing in OS X v10.9 (Mavericks)
Also note that Xcode contains compiler and debugger, so one of the things installing commandline tools will do is symlink or modify $PATH. It also downloads certain things like git.
If for some reason xcode is not installed under
/usr/bin/xcodebuild
execute the following command
which xcodebuild
and if it is installed, you'll be prompted with it's location.
I had XCode Commandline Tools installed for sure, but not XCode itself.
None of the available answers to get the version worked. pkgutil didn't give me the package of the XCode Commandline Tools, with none of the suggested package names.
Not having XCode installed (and having no need for it), I could not look in settings dialogs of that either.
xcode-select --version only gave me the version of xcode-select itself, with no clue as to the commandline tools version.
softwareupdate --list told me everything was up to date.
However I knew that my version must be out of date as the installer for one of homebrew packages told me so!
How I finally found out what version of the XCode Commandline Tools is installed I stumbled upon the command:
softwareupdate --history
Which listed 12.3 as the last version it updated...
Display Name Version Date
------------ ------- ----
Safari 14.0 04/11/2020, 12:26:12
Command Line Tools for Xcode 12.1 04/11/2020, 22:38:33
Safari 14.0.2 15/12/2020, 16:38:27
Safari 14.0.1 15/12/2020, 16:38:27
Command Line Tools for Xcode 12.3 15/12/2020, 16:38:27
macOS Big Sur 11.2.1 14/02/2021, 20:57:56
macOS Big Sur 11.2.2 11.2.2 08/03/2021, 09:02:20
So when you know for sure the commandline tools are installed (because, for instance, xcode-select --install tells you so) but none of the other methods works, check softwareupdate --history!
You can open the Xcode app and go to preferences, the last line shows you if you have tools installed, which tools and lets you change them from the drop-down:
If you have installed Xcode but haven't set the Xcode version. then you will be getting this error. To resolve
Xcode-> preferences -> Locations -> command line Tools -> Select the Xcode version
TL;DR
One can have multiple installations of Xcode and multiple installations of Command Line Tools. This is where the system thinks your CLT are
xcode-select --print-path
Options to select Command Line Tools is in Xcode > Preferences > Locations, including the path for each. I found that brew complains about Xcode or Command Line Tools, and so following details how to install specific version of either.
brew doctor issues after upgrade MacOS
I have always used App store to install and update Xcode on my (2014) Macbook Pro but today after all updates brew doctor was still complaining about Xcode
Warning: Your Xcode (12.4) is outdated.
Please update to Xcode 13.2.1 (or delete it).
and complaining about Command Line Tools
Warning: A newer Command Line Tools release is available.
Get the specific version of Xcode
Download a specific version of Xcode as a xip from Developer.apple.com (I downloaded Xcode_13.2.1.xip)
Move Xcode_13.2.1.xip to /Applications
cd Applications
xip --expand /Applications/Xcode_13.2.1.xip
It takes a while to download, then a while longer to validate the application.
Open /Applications/Xcode.app
Check the CLT in XCode
Xcode> Preferences> Locations shows available CLT and the location (path) of each.
Select the appropriate Command Line Tools
Copy the path.
Go to Terminal and use the path in xcode-select
sudo xcode-select -s /Users/<username>/Applications/Xcode.app
Close Terminal and reopen.
The following was not specific enough:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
But this is good to identify the version
$ /usr/bin/xcodebuild -version
Xcode 13.2.1
Build version 13C100
IF still showing an older version of CLT
Try
sudo xcode-select --switch /Library/Developer/CommandLineTools/
THEN try
Update to a specific version of CLT
First, remove the existing CLT with
sudo rm -rf /Library/Developer/CommandLineTools
Check which CLT updates available
softwareupdate --list
Software Update Tool
Finding available software
Software Update found the following new or updated software:
Label: Command Line Tools for Xcode-12.4
Title: Command Line Tools for Xcode, Version: 12.4, Size: 440392K,> Recommended: YES,
Label: Command Line Tools for Xcode-13.2
Title: Command Line Tools for Xcode, Version: 13.2, Size: 577329K,> Recommended: YES,
Label: Command Line Tools for Xcode-12.5
Title: Command Line Tools for Xcode, Version: 12.5, Size: 470966K,> Recommended: YES,
Label: Command Line Tools for Xcode-12.5
Title: Command Line Tools for Xcode, Version: 12.5, Size: 470820K,> Recommended: YES,
softwareupdate --install "Command Line Tools for Xcode-13.2"
Closed Terminal and reopen
/usr/bin/xcodebuild -version
Xcode 13.2.1
Build version 13C100
Output from:
$ xcode-select -p
/Users/<username>/Applications/Xcode.app/Contents/Developer
And brew doctor shows
Your system is ready to brew.
For macOS catalina try this : open Xcode. if not existing. download from App store (about 11GB) then open Xcode>open developer tool>more developer tool and used my apple id to download a compatible command line tool. Then, after downloading, I opened Xcode>Preferences>Locations>Command Line Tool and selected the newly downloaded command line tool from downloads.

Xcode 4.5 Command Line Tools - xcode-select issue

After installing Xcode CLT 4.5.1 on OS X 10.8.2, I'm having issues installing native ruby gems which need to compiled.
The output error is the same as with running xcrun -find:
xcode-select: Error: No Xcode is selected. Use xcode-select -switch , or
see the xcode-select manpage (man xcode-select) for further information.
To which CLT location should xcode-select point to, since it's no longer at /Developer?
Edit: I don't have the Xcode app installed, only CLT.
The new location seems to be (be sure to run as root):
sudo xcode-select -switch /Library/Developer/
Since your Xcode tools are installed in /usr/bin, you should
sudo xcode-select -switch /
With XCode 4.5 installed AND Command Line Tools installed, I had to use this to get MacPorts and other similar things (like Ruby Gems or Perl CPAN module installation) working:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
I found that /Library/Developer did not work. Note that the Developer folder is not under /Library for me, it's under the app bundle file content folders.
I'm not sure why this is, but people googling this issue may come here and want to know the other commandline options that are commonly usable with xcode-select, thus this answer, even though it doesn't 100% apply to the original question (where command line tools are installed WITHOUT XCode).
you probably want:
xcode-select -switch /Applications/Xcode.app
unless you have multiple installs. that is likely the location if you have one install (e.g. from the App Store). if you have multiple installs, you probably know which one you want.
you could also try updating this value from Xcode's Preferences > Locations > Command Line Tools popup.
Open XCode and go to preferences.
Verify that there is an option under "Command Line Tools"
The error went away for me, as soon as I specified my Xcode command line tools version.
I got further from #jbowes xcode-select -switch /Library/Developer/ answer, but then I hit this:
xcrun: Error: failed to exec real xcrun. (No such file or directory)
I came across this thread (OSX 10.8 xcrun (No such file or directory)) which references a Gist that solved my problem:
https://gist.github.com/thelibrarian/5520597
It's gross, but it seems to be the only way to solve the issue with just the Command Line Tools (i.e. not a full-blown XCode installation).

Resources