Running Hello World Locally (Xcode & Terminal)
Codecademy Team
Published Oct 15, 2019Updated Jun 30, 2023
What is Xcode?
Xcode is an IDE, Integrated Development Environment, containing a suite of software development tools developed by Apple for developing software for iOS, watchOS, macOS, iPadOS, and tvOS.
It was first released in 2003 and the latest stable release is version 11.0 and is available via the Mac App Store for download.
Typically Swift source code files are given the suffix:
- .swift (ex: Hello.swift)
Running Locally using Terminal:
Sometimes it is more convenient to run Swift code in the terminal.
On the Mac, it’s called the Terminal. On Windows, it’s called the Command Prompt.

Let’s see how we can do it in macOS terminal:
$ swift --version
Compile:
$ swiftc Hello.swift
swiftc
and the source file name.
Execute:
$ ./Hello
./
and the executable file name.
Compiling (xkcd)