# How do I start a Swift (6) REPL that allows me to import my package, but without using \`swift run --repl\`?

**URL:** <https://forums.swift.org/t/how-do-i-start-a-swift-6-repl-that-allows-me-to-import-my-package-but-without-using-swift-run-repl/74909>\
**Category:** Using Swift\
**Tags:** repl, swift6\
**Created:** [September 24, 2024, 12:16pm UTC](https://forums.swift.org/t/how-do-i-start-a-swift-6-repl-that-allows-me-to-import-my-package-but-without-using-swift-run-repl/74909 "2024-09-24T12:16:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![corbeling](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@corbeling](https://forums.swift.org/u/corbeling)\
**Post date:** [September 24, 2024, 12:16pm UTC](https://forums.swift.org/t/how-do-i-start-a-swift-6-repl-that-allows-me-to-import-my-package-but-without-using-swift-run-repl/74909/1 "2024-09-24T12:16:22Z")

</div>

Since [`swift run --repl` no longer works for me](https://forums.swift.org/t/with-swift-6-and-swiftpm-swift-run-repl-no-longer-works-with-some-dependencies/74693) when I have certain packages in my dependencies and neither that post nor the SwiftPM bug have gotten any traction, I'm looking for alternate ways to do what I need. So, how can I start a `swift repl` session that'd allow me to `import MyModuleName` (a static library target)?

I tried the simplistic `swift repl -L .build/debug -I .build/debug` but that only lead to the same module redefinition errors I saw with `swift run --repl` _and_ it also failed to find my module:

```plaintext
  1> import CellularAutomataGP
error: error while processing module import: /Users/myusername/Documents/Programming/swift/CellularAutomata/.build/debug/Atomics-tool.build/module.modulemap:2:8: redefinition of module 'Atomics'
module Atomics {
       ^

error: /Users/myusername/Documents/Programming/swift/CellularAutomata/.build/debug/Histogram.build/module.modulemap:2:8: redefinition of module 'Histogram'
module Histogram {
       ^

error: /Users/myusername/Documents/Programming/swift/CellularAutomata/.build/debug/SwiftBasicFormat-tool.build/module.modulemap:2:8: redefinition of module 'SwiftBasicFormat'
module SwiftBasicFormat {
       ^

// ... few hundred lines omitted

error: repl.swift:2:8: no such module 'CellularAutomataGP'
import CellularAutomataGP

```

Frankly it's incredibly annoying that the REPL is now somehow broken compared to 5.10 and that there's seemingly no solution.

---

<div class="post-metadata">

**Author:** ![finestructure](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/finestructure/32/34879_2.png) [@finestructure](https://forums.swift.org/u/finestructure)\
**Post date:** [September 25, 2024, 10:45am UTC](https://forums.swift.org/t/how-do-i-start-a-swift-6-repl-that-allows-me-to-import-my-package-but-without-using-swift-run-repl/74909/2 "2024-09-25T10:45:10Z")

</div>

I’ve never used `swift run --repl` before so I’m not quite sure how it works but perhaps Arena can do what you’re looking for:

> **[GitHub - finestructure/Arena: A command line tool to create Swift Playground...](https://github.com/finestructure/Arena)**
>
> A command line tool to create Swift Playground projects with SPM package dependencies

---

<div class="post-metadata">

**Author:** ![corbeling](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@corbeling](https://forums.swift.org/u/corbeling)\
**Post date:** [September 25, 2024, 5:16pm UTC](https://forums.swift.org/t/how-do-i-start-a-swift-6-repl-that-allows-me-to-import-my-package-but-without-using-swift-run-repl/74909/3 "2024-09-25T17:16:51Z")

</div>

Ah, thank you! Seems like that might do the trick, I'll give it a go.

**Edit:** well I'll be a monkey's uncle, it actually works. Weird that SwiftPM's REPL is borked (wonder if it's the for everybody or is this just my setup somehow?), but this is definitely better than nothing.
