nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.9k stars 639 forks source link

Linux install via Brew #1200

Closed FelixDombek-TomTom closed 2 years ago

FelixDombek-TomTom commented 2 years ago

The brew formula currently needs macOS, but given how trivial it is to build SwiftFormat on Linux (just swift build -c release), would it be possible to change the brew formula so that it can be installed on Linux via brew?

nicklockwood commented 2 years ago

I'll see what I can do

nicklockwood commented 2 years ago

@FelixDombek-TomTom I think this should work now? Can you confirm?

FelixDombek-TomTom commented 2 years ago

Hi Nick, thanks! I had to add the Swift library path to my LD_LIBRARY_PATH before it worked -- I did not have to do that when I compiled it with my own Swift, of course, but I guess there is no way around it, at least I don't know any.

So after

export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/home/linuxbrew/.linuxbrew/Cellar/swift/5.6.1/libexec/lib/swift/linux"

to solve

$ ./swiftformat --version    
./swiftformat: error while loading shared libraries: libswift_Concurrency.so: cannot open shared object file: No such file or directory

it now works.