installing "make" on Mac - macos

I'm trying to install Memcached on Mac using this tutorial:
http://tugdualgrall.blogspot.de/2011/11/installing-memcached-on-mac-os-x-and.html
but when I try ./configure
it says:
configure: error: no acceptable C compiler found in $PATH
when I try make it says:
make
sh: make: command not found
sh-3.2# yum install make
sh: yum: command not found
sh-3.2# apt-get install make
sh: apt-get: command not found
I must mention that I have Xcode but it's still not working.
I'm really new on Mac so please take that into consideration :)
I would really appreciate your help
Thanks!

If you have Xcode 4.3 or newer the command line tools, such as make, are not installed by default. In Xcode preferences go to the "Downloads" tab and under "Components" push the "Install" button next to "Command Line Tools". After you have successfully downloaded and installed the command line tools you should also type the following command in the Terminal to make sure all your Xcode command line tools are switched to use the 4.3 versions:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Once everything is successfully installed you should see make and other command line developer tools in /usr/bin.

From torrey.lyons's answer, in Xcode --> Preferences --> Downloads it says under Command Line Tools:
Before installing, note that from within Terminal you can use the
XCRUN tool to launch compilers and other tools embedded within the
Xcode application. Use the XCODE-SELECT tool to define which version
of Xcode is active. Type "man xcrun" from within Terminal to find out
more.
Therefore, I was able to run the make tool with the command xcrun make.

Things have changed in Mac OS 11 (Big Sur). There is now a command line tools package. Search for "Command Line Tools for Xcode 12.5.1" (or newer) on Apple's Developer Network.

Related

tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

This is very much a duplicate of xcode-select active developer directory error except none of those solutions worked for me.
$ sudo xcode-select --reset
$ sudo xcodebuild -license accept
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
$ sudo xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I don't even have xcode on my machine.
The fix for me here was that my [ XCode > Preferences > Locations > Command Line Tools ] dropdown was empty. No idea why. But after clicking it and selecting the only available option my "active developer directory" error finally went away.
Mac Os 12.3.1 | Date: 5/4/22
I had this problem because Xcode was installed in my user application directory (~/Applications) instead of /Applications. From the Github link above figured out I needed to run:
sudo xcode-select -s ~/Applications/Xcode.app/Contents/Developer
(note the tilde). After this everything worked.
I had "xcode-select active developer directory error" too when installing Xcode beta. In your case you don't even need full Xcode, command line tools should work fine. Read this Github issue
This error completely contradicts that setting the path to /Library/Developer/CommandLineTools is the workaround for the latest XCode/MacOS combo failing to find the command line tool commands under /Application/Xcode.App/ with the default path setting.

Installing Xcode command line tools

I performed a fresh install of macOS Mojave 10.14. Immediately after that I installed Xcode Version 10.0 (10A255) from the Mac App Store.
Now, I wish to install Homebrew which requires Xcode command line tools to be installed. My understanding is that installing Xcode also installs the command line tools. Or not?
As per this answer, I checked if the command line tools are installed by running:
xcode-select -p
which printed the path for the Developer directory as follows:
/Applications/Xcode.app/Contents/Developer
As suggested in the answer, I also verified the return value by running:
echo $?
which retuned 0.
I also ran, gcc and make and bash was able to locate and execute them.
Thus far I am convinced that the Xcode command line tools are installed. Now when I execute:
xcode-select --install
I get this alert:
What's the probable reason for this disparity? Will this install Xcode command line tools twice? Or overwrite the existing installation?
As I understand, Xcode command line tools can be installed without installing Xcode. Also, from my previous experience, if the command line tools aren't installed separately from Xcode (by running xcode-select --install), they are not detected by Homebrew, i.e. when running brew config, the value for CLT: is shown as N/A.
Here's the complete picture (pardon the pun):
Although I am talking in context of macOS Mojave, the question remains the same with regard to previous versions of macOS.
What is the advisable approach to take here?
Note: After installing Xcode, I launched it, accepted license agreement and let it finish its run of installing additional tools (which is a one time activity).
Following worked for me, only command line tool can also me installed.
After you updated to Mojave 10.14 Go to https://developer.apple.com/download/more/ search for "command line" then
Download "Command line tool for MacOS 10.14"
Once dmg is downloaded install the package.
Verify package installation

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.

installed full xcode on mavericks macbook, but homebrew install says command line tools not installed

Installed the full XCODE (about 2 GB) in a brand new mavericks macbook, using App Store, then rebooted. Ran Xcode. Went to Preferences > Location, verified Command Line Tools shows up (v 5.0.2 5A3005).
In terminal, xcode-select -print-path shows /Applications/Xcode.app/Contents/Developer plus I can now run gcc --version and see version info.
So AFAIK command line tools are installed.
However, when I try to install homebrew, it opens the gui dialog offering to install XCode or the command line tools.
I don't want to end up double-installing, with conflicting paths, so any help on why the brew installer isn't "seeing" the commandline tools would be appreciated.
As noted in my comment, it is in fact a homebrew issue that it's not able to find the command line tools 'inside' Xcode due to Xcode recently changing where the command line tools were located... see these two issuesL github.com/Homebrew/homebrew/issues/24471 and github.com/Homebrew/homebrew/issues/20427
The solution was therefore to simply accept the option to install the command line tools when the gui window pops up after homebrew can't find them.

Installing command line tools Xcode 5

I have tried and tried (looked at many headings for this) and I still don't have an answer to my problem. I am trying to install the Pebble SDK 1.12 and install command line tools of Xcode 5.
Everytime I try xcode-select --install in terminal I get "Can't install software because it is not currently available in the Software Update server"
I have tried to reinstall Xcode and that didn't work.
When I got to Xcode-preferences-downloads there isn't a section for the command line tools.
I have also tried installing them from the Developer site but to no avail. The download looks correct and then I go to Xcode to see the preferences and the command line tools aren't listed.
Anything you all can suggest?
Using xcode-select --install in Terminal and choose install tools
On OS X 10.9, the Command Line Tools component no longer appears in the Preferences pane for Xcode 5, unlike on OS X 10.8. Also, the not currently available message appears to be a bug in OS X 10.9 when the currently installed Command Line Tools are already up-to-date. If you have a populated /usr/include directory and /usr/bin/cc --version gives you something, you're probably fine.

Resources