问题
I am fairly new to apple and osx. I installed xcode from the app store, and now I have a make-executable in my filesystem:
192:~ herbert$ locate make | grep bin
/Applications/Xcode.app/Contents/Developer/usr/bin/gnumake
/Applications/Xcode.app/Contents/Developer/usr/bin/make
/opt/X11/bin/gccmakedep
/opt/X11/bin/makedepend
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/cross/m68k-elf-binutils/files/binutils-makeinfo-check.patch
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/cross/mipsel-linux-binutils/files/300-001_ld_makefile_patch.patch
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libinchi-1/files/patch-INCHI-1-API_INCHI_API_gcc_so_makefile-makefile.diff
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/science/indi/files/patch-libindi.pc.cmake.diff
/usr/X11/bin/gccmakedep
/usr/X11/bin/makedepend
/usr/bin/makeinfo
/usr/sbin/makedbm
192:~ herbert$
Unfortunately it is not in my path. As appending /Application/Xcode.app/Content/Developer/usr/bin/ to my path would be an options, it seems as something not to do. Can I somehow install it to /usr/... or /opt/local/...?
192:~ herbert$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
192:~ herbert$
回答1:
You have to install the Command Line Tools (or Unix Development Tools, in older versions) if you want to build from the command line.
In 4.3.1, the way to do this is to launch Xcode, open Preferences, click the Downloads tab, click the Components sub-tab, and click the Install button next to "Command Line Tools".
In earlier versions, the equivalent may be automatic, or it may be a choice in the initial installer, or it may be a separate installer to run.
There's also the xcrun
tool, which lets you use the toolchain without installing the CLT, and for simple tasks you can, e.g., set CC
to xcrun clang
, MAKE
to xcrun make
, etc., or even hard-link xcrun
to /usr/local/bin/clang
, /usr/local/bin/make
, etc. But setting up everything this way is a lot of work, and it still isn't sufficient to build many source-distributed projects.
来源:https://stackoverflow.com/questions/10921690/on-apple-osx-lion-make-not-in-path