74

I have a MacBook Pro that I'm trying to do some development on.

I have a program I want to build, and when I went to use make to build it, I got a "command not found" error. I did some googling and Stack Overflow searches and it doesn't look like this is a common problem. Why don't I have make installed and how do I get it?

I'm extra confused, because I know I used it relatively recently (in the past month or so) when I was on this laptop.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alex
  • 14,973
  • 13
  • 59
  • 94

11 Answers11

131

For those of you who get to this page using Xcode 4.3 and Lion, the command line tools are no longer bundled by default, and there is no /Developer anymore. To install them, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools. This should install make, gcc etc.

Daniel
  • 2,699
  • 3
  • 22
  • 17
  • 10
    You can also download them from here: [apple developer downloads](https://developer.apple.com/downloads/index.action#) – josh Apr 28 '12 at 18:56
61

Have you installed the Apple developer tools? What happens if you type gcc -v ?

It look as if you do not have downloaded the development stuff. You can get it for free (after registration) from http://developer.apple.com/

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Friedrich
  • 5,916
  • 25
  • 45
  • I know I had this installed before. The only thing I can think of that happened between now and the last time I used it is installing Snow Leopard. In any case, reinstalling the development stuff. Thanks. – Alex Sep 24 '09 at 06:48
  • 3
    Yes, Alex. Upgrading to SL seems to wipe out a number of development tools, including gcc and make. For me, I upgraded XCode to 3.2 and along with that, installed the development tools. – ayaz Sep 24 '09 at 06:52
  • Well I can not see why it should not be free any more. See http://developer.apple.com/technologies/tools/ – Friedrich Nov 16 '11 at 05:22
  • 3
    if you're using XCode 4.3, command line tools are not included by default, see my comment below for how to install them – Daniel Apr 24 '12 at 15:54
  • Well you can download a make from somewhere else. Anyway if you do a full development install on Linux you will not just get make either... – Friedrich Nov 21 '12 at 10:30
18

There is now another way to install the gcc toolchain on OS X through the osx-gcc-installer this includes:

  • GCC
  • LLVM
  • Clang
  • Developer CLI Tools (purge, make, etc)
  • DevSDK (headers, etc)

The download is 282MB vs 3GB for Xcode.

Ben
  • 1,441
  • 4
  • 18
  • 20
13

You will have to install the "Developer Tools" that are provided as optional packages in OS X installation disks.

ayaz
  • 10,406
  • 6
  • 33
  • 48
9

For Xcode 4.1 you can simply add /Developer/usr/bin to the PATH environment variable. This is easily done:

$ export PATH=$PATH:/Developer/usr/bin

Also be certain to update your ~/.bashrc (or ~/.profile or ~/.bash_login) file.

Jay Baxter
  • 416
  • 5
  • 10
8

In addition, if you have migrated your user files and applications from one mac to another, you need to install Apple Developer Tools all over again. The migration assistant does not account for the developer tools installation.

Nicolaj Schweitz
  • 722
  • 7
  • 12
  • I just ran into this problem! I used time machine to move my dev machine from my old laptop to my new one and X-Code for iOS still works but gcc and make are missing from the Unix command line. – MikeN Mar 31 '11 at 22:48
5

If you've installed Xcode 4.3 and its Command Line Tools, just open Terminal and type the following: On Xcode 4.3, type the following in Terminal:

export PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin

Eric
  • 16,003
  • 15
  • 87
  • 139
5

@Daniel's suggestion worked perfectly for me. To install

make
, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools.You can then test with
gcc -v
Pea
  • 431
  • 7
  • 9
4

I agree with the other two answers: install the Apple Developer Tools.

But it is also worth noting that OS X ships with ant and rake.

Harold L
  • 5,166
  • 28
  • 28
1

I believe you can also get just the Xcode command-line tools which is about 170 MB.. It's described in the 'brew' setup guide: https://github.com/mxcl/homebrew/wiki/installation and can be found here: https://developer.apple.com/downloads/index.action#

Edit: this was already mentioned above by @josh

1

I found the Developer Tools not as readily available as others. In El Capitan, in terminal I just used gcc -v, it then said gcc wasn't available and asked if I wanted to install the command line Apple Developer Tools. No downloading of Xcode required. Terminal session below:

Pauls-MBP:~ paulhillman$ gcc -v
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Pauls-MBP:~ paulhillman$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
phillman5
  • 71
  • 1
  • 1