I've been fiddling around in my free time trying to get Swift 4.something to run on a Raspberry Pi 3 B+ with Raspbian Stretch. I found a repo on GitHub which looked promising, but after building it overnight, I discovered the maintainer of the repo left something out of the script and it blew up.

I've also downloaded a pre-compiled version (4.1.2), but the instructions I've found are incomplete. It untarring the file leaves a /usr/ directory in my download folder, but I can't find instructions on what to do with that directory.

I'm presently using Raspbian Stretch for the operating system. I've tried installing Ubuntu, but I get the lightning bolt of death when I boot up. Ubuntu is not an option for Raspberry Pi 3 B+, according to Ubuntu's website.

Does anyone out there have a set of instructions for installing Swift (4.whateverIsAvailable) on a Raspberry Pi 3 B+ that assumes the person reading the instructions eats paste and crayons?

  • I'm having to take a bit of a guess which swift you're talking about and what files you found. Have you tried downloading it right from the swift project? swift.org/download/#releases The Ubuntu release is possibly your best bet, but we don't know what OS you're running either.
    – T. M.
    Dec 21, 2018 at 1:07
  • @T.M. Thank you. That was the first place I looked. LOL. I tried installing Ubuntu on my Pi 3 B+, but I get the lightning bolt of death when I boot. I hooked up a multimeter up to my Pi and checked voltage and I'm getting enough.
    – Adrian
    Dec 21, 2018 at 1:11
  • So what OS are you using? Even if you're using Raspbian, it is Debian based as it Ubuntu, so that Ubuntu release should be your best bet. You're going to have to give a lot more details for anyone to help.
    – T. M.
    Dec 21, 2018 at 1:17
  • I'll update the question, as I only added it on the tag. I'm using Raspbian Stretch. I got a few memory cards, so I can etch another one.
    – Adrian
    Dec 21, 2018 at 1:18
  • 2
    The Ubuntu version is not an option because there's no ARM version for Raspberry Pi 3 B+. The Raspberry Pi 3 B+ will not run Ubuntu.
    – Adrian
    Dec 21, 2018 at 1:46

1 Answer 1


If you've got a Raspberry Pi 3 B+, there are several options for getting Swift to install on your Pi.

Option 1: Raspbian Stretch

buildSwiftOnARM repo on GitHub has a link to a pre-compiled binary.

  1. Download it from the link on buildSwiftOnARM.
  2. The file will land in /home/pi/Downloads/
  3. Untar the file with the following command: tar zxvf swift-4.1.3-RPi23-RaspbianStretch.tgz
  4. Upon completion of Step 3, you should hae a directory called home/pi/Downloads/usr/ that's got all the Swift files in it.
  5. Next, copy the files from that directory with the following command: sudo cp -R /home/pi/Downloads/usr/ /

At that point, typing swift --version should tell you what version you've got installed on your Pi. Unfortunately, I haven't found anything that works for cross compiling Xcode projects created on a Mac to build on an ARM processor, so for now, you're stuck editing on the Pi. I've found the easiest route to go is Visual Studios Code compiled for ARM processors. This build of Visual Studios Code can be called from the command line using code-oss. You can add basic autocompletion, linters, etc. as you normally would within Visual Studios Code.

Another option is Hypriot. While this works OK, you can't cross compile on a Raspberry Pi 3 B+ as of 12/26/2018, so you're left editing in vim.

Option 2: Hypriot

  1. Download Hypriot & unzip it
  2. Download & install Balena Etcher
  3. Insert a microSD card you don't mind nuking into your Mac.
  4. Open Disk Utility
    • format your SD card as MS-DOS (FAT) with the scheme Master Boot Record
  5. Open up Balena Etcher
    • Select the Hypriot image
    • Select your newly nuked & formatted microSD card
    • Etch it
  6. Once it's done etching, dismount the drive if it doesn't do so automatically and insert it in your Pi 3 B+
  7. Boot up your Raspberry Pi 3 B+
  8. Login to your pi. Username is pirate, password is hypriot (CHANGE THIS AT SOME POINT)
  9. Setup your WiFi by typing sudo nano /etc/wpa_supplicant/wpa_supplicant.conf, which will open nano.
  10. Here's what got WiFi working in my wpa_supplicant.conf file:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
        psk="YOUR PASSWORD HERE"
  11. Ctrl + X to exit nano

  12. Your WiFi won't work until you reboot. Shutdown the Raspberry Pi 3 B+ with sudo halt
  13. Wait until the lights stop flashing on your Pi to unplug it, then unplug and replug it.
  14. When you reboot and login, try sudo ping cnn.com to verify your WiFi works & Ctrl+C to stop the pinging

At this point, you've got a Raspberry Pi 3 B+ setup that runs Hypriot. Next, you'll want to mosey on over to helje5/dockSwiftOnARM. There's a bunch of links there for getting it going.

Install Swift for Docker

  1. Type docker pull helje5/rpi-swift, which will pull down the latest version of Swift for ARM onto your Pi. It'll take a few minutes to finish and you'll see updates on progress in terminal.
  2. Type docker run --rm helje5/rpi-swift-dev swift --version

At this point, you should see this outputted in your terminal:

Swift version 4.1.2 (swift-4.1.2-RELEASE)
Target: armv7-unknown-linnux-gnueabihf
  1. Celebrate

Creating a project

Here's a link for cross compiling a Swift project using Docker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.