💥 Backtraces for Swift on Linux and Windows

What's New

SwiftBacktrace 1.3.3


SemVer patch

  • #59 update vendored copy of libbacktrace
  • #60 flush stderr after printing backtraces

Full Changelog: 1.3.2...1.3.3


This Swift package provides support for automatically printing crash backtraces of Swift programs.

The library is designed to fill a gap in backtraces support for Swift on non-Darwin platforms. When this gap is closed at the language runtime level, this library will become redundant and be deprecated.


When building web-services and daemons, direct usage of this library is discouraged. Instead, use swift-service-lifecycle which helps manage the application lifecycle including setting up backtraces hooks when needed.

Add https://github.com/swift-server/swift-backtrace.git as a dependency in your Package.swift.

Crash backtraces

In your main.swift, do:

import Backtrace

// Do this first

Finally, for Swift < 5.2, make sure you build your application with debug symbols enabled. Debug symbols are automatically included for Swift 5.2 and above.

$ swift build -c release -Xswiftc -g

When your app crashes, a stacktrace will be printed to stderr.


Please see SECURITY.md for details on the security process.


Ian Partridge (GitHub, Twitter) the original author of this package.

Johannes Weiss (GitHub, Twitter) for the signal handling code.

Saleem Abdulrasool (GitHub, Twitter) for the Windows port.


  • Swift Tools 5.0.0
View More Packages from this Author


  • None
Last updated: Fri May 26 2023 10:35:55 GMT-0500 (GMT-05:00)