Adding support for installing executables and libraries to Swift PM

Is there any plan in the Swift PM team to add an install command to the Swift Package Manager? I think it would be a really useful feature


A first version could support executable products only. So with:

$ swift install
# or
$ swift install # installs the current package

Swift PM would compile all the Package executable products in release mode and install them in a known location (eg. ~/.swiftpm/bin/).


Supporting installed libraries could be a bit more complicated as it would require deciding how to handle the Package dependencies but I think it would be very useful. For example, right now the only quick/easy-way to try a Swift PM library is to use swift run --repl (but that way you can only access one package per REPL session). Installing library products would mean that you could use all of them in a REPL session or in a Jupyter Notebook.

This is something I also want and have been casually working on a formal proposal. Unfortunately there are some complications as you pointed out with libraries that have to be resolved before an install command can be a reality. Swift 5 will hopefully open up the door to this being a reality thanks to ABI stability though.

The main questions that need answering that I am aware of are:

  • Where do we install libraries and executables?
  • How do we handle multiple versions of libraries or executables?
  • How are resources going to work? There are others working on a proposal for this.

Since these are the pre-requisits that I see I have been starting to figure out how to handle the libraries. Unfortunately I haven't had much time to do so the last month...

1 Like

This is a great proposal, thanks! Building Docker images with server-side Swift would get so much faster, if we have such feature.

Terms of Service

Privacy Policy

Cookie Policy