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?
Related
I am currently trying to learn root for my research team and getting installed on my mac. I have been following the instructions detailed at this website and hit a snag. I've successfully installed the root package and command line tools, as well as assigned ownership of the folder to my user, however whenever I try to run
./configure
it gives the following error report:
Checking for Xcode OSX SDK ... no
configure: no Xcode OSX SDK found at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
Run xcode-select to update the developer directory path
or make sure the desired SDK version is installed
After re-downloading Xcode and the command line tools, I've hit an impasse. The folder is obviously there, albeit seemingly as an alias (as can be seen here) despite not being that before I started writing this and running
xcode-select -s '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk'
it only responds with:
invalid developer directory '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs'
Anything you can tell me to get this going will be a great help.
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.
I'm trying to make an OSX bundle using CMake/CPack on OSX that involves OpenCV and Qt (although I don't think those dependencies matter at this point). Everything compiles and the bundle is created fine, and I have a script that modifies the necessary library paths such the executable I'm making works if I run it from the Terminal within the bundle. The problem I'm having is if I try to run the MyApp.app file via the open command or by simply double clicking the app it gives me the error:
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/
I've seen other solutions to other LSOpenURLsWithRole() errors involving modifying permissions, but that hasn't helped me. Also, this error code is an "unknown error" so I'm not sure how to proceed.
The solution for this ended up being that the libcocoa.dylib library was not finding the requisite libraries. See Building OSX App Bundle for a thorough answer on the subject. otool -L is your best friend.
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
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