title: Unable to run Swift code using Command Line Tools
body: <p>I downloaded Xcode CLT from developer.apple.com/downloads and then installed the package.</p>
  
  <p>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:</p>
  
  <pre>
  $ 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
  </pre>
  
  <p>I am especially concerned with the "dyld" line which is about line # 3 in that output.</p>
  
  <p>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.</p>
  
  <p>So, the questions are:</p>
  
  <ul>
  <li>why am I getting the "dyld: Library not loaded:..." error?</li>
  <li>how can i fix it?</li>
  <li>how can I write, compile and run simple Swift code on the command line before downloading the entire XCode?</li>
  </ul>
  
  <p>Your help is greatly appreciated. Anxiously waiting for your reply.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>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".</p>
  
  <p>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!</p>
  
  <p>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.</p>