bash: make: command not found - macos

I am in a directory with a Makefile, but can't use I cannot use make
bash-3.2$ make
bash: make: command not found
How do I fix this?

Make, among other things, is available through Apple's Command Line Tools. Install Command Line Tools through XCode by going to XCode->Preferences->Downloads
You can also download Command Line Tools without installing XCode from the Apple Developer site: https://developer.apple.com/opensource/

If you have XCode installed then #Wex's answer will get you going quickly, otherwise you don't have to install Xcode to get the command-line tools you seek.
Check this out: https://github.com/kennethreitz/osx-gcc-installer
You will want to install this one on Lion: https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg
Good luck!

I had the same problem. I was about to download and install command line tools until I saw in the download window that you can just use:
xcrun make

Related

Any way to stop Xcode from generating folders like this?

I was trying to build GMP on OS X, and it fails with the following error:
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup: No such file or directory
The problem is due to this command:
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/SMSandboxTools-tmp/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Someone isn't parsing the directory name properly. Does anyone know how to prevent Xcode from generating folders with spaces in the names?
You can't prevent Clean at Startup from being generated.
Your build script could either escape the spaces, or simply put the whole path in quotes. For example, this doesn't work:
$ cd /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup
But this does:
$ cd "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup"
If you don't want to fix the script yourself, I would just open an issue with the GMP developers.
My installation was botched. (Cleanup at Startup sounds an awful lot like something the OS leaves around for dealing with after an update... and I did have an update with issues.) I'm guessing Apple's developers have encountered this before, as the Xcode manual for the command line tools has the following:
The Command Line Developer tools package has been updated to include xcrun. xcrun adds support for the following:
1. The --show-sdk-path option queries SDK paths
Invoking xcrun --show-sdk-path gave the nasty, ugly path with Cleanup at Startup. On the same help page is this:
On OS X Mavericks, xcode-select provides the --reset flag to revert to using the default search paths.
I invoked xcode-select --reset, and that fixed my problem! GMP built smoothly, and xcrun --show-sdk-path now displays nothing... which seems weird, except that, as I say, gmp ran, tested 100% correct, and installed.

Unable to run Swift code using Command Line Tools

I downloaded Xcode CLT from developer.apple.com/downloads and then installed the package.
Wanting to try my hands at Swift, I attempted to write a simple "hello, world" program, but, things seemed to be "wrong" from the first moment I started it. Look at the following screen output:
$ xcrun swift
Welcome to Swift! Type :help for assistance.
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/repl_swift
Reason: image not found
1> s="hello, world"
Error in auto-import:
failed to get module 'Swift' from AST context
1> ^D
I am especially concerned with the "dyld" line which is about line # 3 in that output.
I searched around on the web and found that this is caused by some certificate mismatch issues. But, I have neither requested any certificates from Apple, nor issued any certificates to anyone. I just want to try out Swift without downloading the entire XCode.
So, the questions are:
why am I getting the "dyld: Library not loaded:..." error?
how can i fix it?
how can I write, compile and run simple Swift code on the command line before downloading the entire XCode?
Your help is greatly appreciated. Anxiously waiting for your reply.
Edit:
Here's how I installed the tools: I downloaded the tools from the developer.apple.com/downloads web site. I got a dmg file, which I clicked. It contained a package file. When I clicked that, it brought up a nice popup that said something to the effect "installing". I went through all the dialogs it threw at me, selecting all the default values. After a few moments, it said "installed".
I then opened emacs, wrote 10 lines of c, compiled and ran it. worked! So, I got on the web, located the most elementary swift program I could find, copied it and attempted to run it ... and boom ... I got that error. So I started the swift interpreter and typed code into it. Nope! That didn't work either!
So, given all that ... I feel I did my best to install the tools, but, please let me know if I have missed any step that could have caused the CLT to install partially and not completely.
failed to get module 'Swift' from AST context
Use the xcode-select command-line tool:
sudo xcode-select --switch /Applications/Xcode.app
or if you are using Xcode-beta then use this:
sudo xcode-select --switch /Applications/Xcode-beta.app
From the xcode-select manual:
After setting a developer directory, all of the xcode-select provided developer tool shims ... will automatically invoke
the version of the tool inside the selected developer directory.
For more info:
man xcode-select
cd /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources
and then
sudo install_name_tool -rpath #executable_path/../../../../../Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx /Library/Developer/CommandLineTools/usr/lib/swift/macosx repl_swift
Will get rid of the first part of the error. I can't figure out the 2nd part yet. (Error in auto-import). Anyone have any ideas based on the first part of the solution?

How to build OpenCASCADE on MAC (Mountain Lion)

I am trying to build OpenCASCADE on Mac, but I am not having any luck.
I downloaded it from Github in tar.gz, but I am really new to Mac and I am stuck.
Can anybody explain what should be my next step?
(I found some terminal commands what I should use, but I am not familiar with them. So if it is the right way to build OpenCASCADE on Mac please write down the terminal commands with details. Thank you!)
EDIT:
I understood the command line commands now from the link below. I understood it before too, but I was mistaken, because my main problem was, that I didn't had gcc installed (XCode does not installs gcc automatically...). So anyways, now finally I can run the cmake command. It starts but it ends with this:
CMake Error at /Applications/CMake
2.8-9.app/Contents/share/cmake-2.8/Modules/FindX11.cmake:420 (MESSAGE): Could not find X11 Call Stack (most recent call first):
CMakeLists.txt:313 (FIND_PACKAGE)
Anybody have any idea what to do? I tryed to search this too here, and google...and I found some "solutions" but those didn't work for me.
EDIT EDIT:
The solution for the last edit is that Mountain Lion doesn't install X11. So open up an app that uses X11 or Xquartz and it will install automatically.
Unfortunetly it still doesn't work. My next error message is the following after the make command in terminal:
In file included from
/Users/davidbirkas/Documents/tpaviot-oce-6c9a06a/src/AlienImage/AlienImage_X11XWDAlienData.cxx:14:
/Users/davidbirkas/Documents/tpaviot-oce-6c9a06a/inc/Aspect_XWD.hxx:5:12:
fatal error:
'X11/XWDFile.h' file not found
# include
^ 1 error generated. make[2]: * [adm/cmake/TKService/CMakeFiles/TKService.dir/_/_/__/src/AlienImage/AlienImage_X11XWDAlienData.cxx.o]
Error 1 make1:
[adm/cmake/TKService/CMakeFiles/TKService.dir/all] Error 2 make: **
[all] Error 2
Any ideas how to fix this?
Ensure that, together with XCode, you also install the X11 support from Apple's Devtools. Your error message is indicating that it is missing.
FWIW, I have written a blog post about OCC and PythonOCC on Mac some time ago. Maybe you'll find some detailed info there.
http://cad-3d.blogspot.com/2011/10/pythonocc-open-source-interactive-cad.html
In this post, I still talk about using the binary installer, but recent updates to the OCE edition compile usually without problems out-of-the-box, also on OSX (that is NOT the case with the official OpenCASCADE release).
I spent a little time on this and I think I have it. Here is what I did step by step:
Preparation phase:
Installing Xcode (with command line tools) = Apple developer site
// If Xcode doesn't install gcc, than you can still download it from the developer site as Command Line Tools for Xcode.
Installing Cmake (with command line tools) = Google
// You can download it from the official site with a .dmg/.pkg file extension. Easy install.
X11 under Mountain Lion "changed" to Xquartz. Probably it is not installed by default, but it is easy to check it. Just go to the folder "Application" and start the X11 app. If X11/Xquartz is not installed than it will install automatically!
Installing FTGL = MacPorts = Google
// Download MacPorts from their official site, install it with the installer, than write this to the terminal:
sudo port install ftgl
Download OCE and extract it (.OCE-0.9.0.tar.gz file) = https://github.com/tpaviot/oce/wiki/Download
Installing phase:
I. Open Terminal.
II. Run this command
// This will set the proper PATH.
ln -s /opt/X11/include/X11 /usr/local/include/X11
III. Than from the Terminal go to the directory where you extracted the OCE file (the original extracted file name should be: tpaviot-oce-6c9a06a).
IV. Than write these commands:
// You make a build directory to the extracted OCE folder.
mkdir build
cd build
V. After this you give out the cmake command:
cmake -DOCE_INSTALL_PREFIX:PATH=$HOME/OCE \
-DOCE_WITH_FREEIMAGE:BOOL=ON \
-DOCE_WITH_GL2PS:BOOL=ON \
-DOCE_DRAW:BOOL=ON \
..
VI. And at the end the make commands:
make
make install/strip
If you did everything exactly like this, than it should work!
Give OCE a try. Compiling for osx is a walk in the park

How to install native assembler for Mac OSX?

I am interested to know how can I install native assemblar (I think also known as AS) on Mac OSX Lion. Someone suggested that I can use the Xcode to do it but I didn't see any options.Terminal windows is not able to recognize AS as command right now. Can someone provide more insight on this ? I am new to Mac/Unix environment so please provide help accordingly.
If you have Xcode installed, then you have as.There is no option to install specific packages from the Xcode installer.
as should be in /usr/bin/:
ls -l /usr/bin/as
If not, you probably have a problem with your Xcode installation.
Otherwise, also check your PATH environment variable, to ensure /usr/bin/ is in the list.
echo $PATH
If you've installed Xcode 4.3, it doesn't install the command line tools anymore. To get them, you have to launch Xcode, go to Xcode > Preferences... > Downloads tab, then click the 'Download' button for 'Command Line Tools'. You'll need to sign in with an Apple Developer ID.
Using Xcode 4.6 with Command Line Utilities installed
export PATH=/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
as will execute along with the other command line utilities.

Where is gcc on OSX? I have installed Xcode already

I have installed Xcode from the Tool cd, I thought that would let me use gcc from the command line but I can't find it.
What am I missing
EDIT
When I wrote I can't find it I meant "I look for it using which gcc"
If gcc would have been in the PATH in first place, which would have find it.
Since gcc is not in the PATH ( that's what brought me here in first place ) which won't find it!
I think that was obvious but I'm making the note here because it wasn't
As of version 4.3.1, XCode is now an application and the command line tools are now available through the Preferences (this is documented in the App Store for XCode under 'What's New in Version 4.3.1' if you click 'More...'). After installing XCode, open it, open the Preferences and click on the Download tab. Click on 'install' for the 'Command Line Tools' and then sign in with your computer's password. The code will then be downloaded and installed.
You didn't check the box that says "UNIX Development Support"[1] (or possibly you unchecked it; I can't remember if it's on by default or not) when you did the install, so it didn't install the necessary symlinks and drivers in /usr/bin/.
Reinstall, and make sure to read the descriptions of the configuration options and select the ones that you need.
1: "Optional content to allow command-line development from the boot volume. Installs a duplicate of the GCC compiler and command line tools blah blah blah..."
Something went wrong with your install.
gcc is installed under /usr/bin with a symlink to gcc-4.2:
cd diciu$ pkgutil --file-info /usr/bin/gcc-4.2
volume: /
path: /usr/bin/gcc-4.2
pkgid: com.apple.pkg.gcc4.2Leo
pkg-version: 4.2.0.9000000000.1.1249367152
[..]
pkgid: com.apple.pkg.Xcode3.2.1Update
pkg-version: 1.0.1.1249367152
[..]
pkgid: com.apple.pkg.Xcode3.2.1UpdateUNIXDevSupport
pkg-version: 1.0.1.1249367152
[..]
On my Mac $ which gcc displays /usr/bin/gcc.
Xcode 4.3+ you need to install 'Command Line Tools for Xcode' found here: https://developer.apple.com/downloads
Is it possible that rather than not having gcc installed, your $PATH variable is messed up? first check if gcc is in /usr/bin manually. Then echo $PATH...
The same thing happened to me. It worked for a while and then went away. Reinstall and it will be fixed.
You might want to download Xcode from Apple while you are at it. Almost guaranteed to be fresher / more up-to-date since Xcode is rapidly updated. Current Xcode is 3.2.1.10. You need an Apple ID to download, but that also gives you access to the development site. All free... .
It is 1/6/2014. Current Xcode is 5.0.1
It is 2016 -- Current Xcode is 8.0. I think this question should be closed now.
Yes, try to install 'command line tools' by clicking Preferences-Downloads-command line tools.

Resources