What's the difference between swift and swiftc?
I've read some resources saying that swiftc is a symbolic link to swift, but this is not the case on macOS Mojave 10.14.6:
-rwxr-xr-x 1 root wheel 18288 Jul 29 23:49 /usr/bin/swiftc
Both swift and swiftc contains OVERVIEW: Swift compiler
as part of their --help
menu, but while their options are similar, they are different.
swift
is an interactive environment (REPL) for Swift.
swiftc
is the Swift compiler.
The files in /usr/bin
are just redirectors to the currently selected version (based on xcode-select
). If you look at the filesize you'll note these are only 18kB. They're not the real executables.
The actual version can be found using xcrun:
$ xcrun -f swift
/Applications/Xcode-beta7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
If you look in that directory, you'll see that swiftc
is a symlink to swift
(which is a 90MB executable). The executable just checks what name it was run as, and adjusts its behavior accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With