Comments (13)
After entering your @stackotter command and trying to enter swift-format -v
I've got the following error message.
dyld[18324]: Library not loaded: '@rpath/lib_InternalSwiftSyntaxParser.dylib' Referenced from: '/usr/local/bin/swift-format' Reason: tried: '/usr/lib/swift/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/local/bin/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/lib/swift/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/local/bin/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/local/lib/lib_InternalSwiftSyntaxParser.dylib' (no such file), '/usr/lib/lib_InternalSwiftSyntaxParser.dylib' (no such file) zsh: abort swift-format -v
from swift-format.
I'm not sure what's causing the issues in the previous versions, but you may want to try out the just-released 508.0.0 version. It no longer depends on lib_InternalSwiftSyntaxParser.dylib
nor does it have the requirement that it matches the specific version of the toolchain you're using (beyond being able to compile it in the first place).
(I don't control the Brew distribution, so you'd have to install it by downloading the release sources here and building them with swift build
.)
from swift-format.
What commands did you use to install swift-format
? My guess is that the built executable didn't get added/copied to your path. I believe you can fix that by running cp .build/release/swift-format /usr/local/bin/
inside the swift format directory. Another method would be to use Mint to install the tool, however Mint is not really being maintained anymore and I don't think it's the best to recommend it.
from swift-format.
I've used these commands
VERSION=0.50700.0 # replace this with the version you need git clone https://github.com/apple/swift-format.git cd swift-format git checkout "tags/$VERSION" swift build -c release
Yes, I also thought that my created executable could not be added to the path. I already tried to added it but it didn't work. But I have to say, I'm new to the apple universe, so maybe I did something wrong.
I will try your command, thx
from swift-format.
Hm had a feeling that might happen with my naive copy-to-path solution. You can installing it with Mint or replacing your command with the following (temporarily):
/path/to/repo/.build/release/swift-format lint -r -p --configuration formatConfig.json "${PROJECT_DIR}/ChatApp"
I'm interested why adding it to your path didn't work though, try running the following commands. Make sure to replace /path/to/repo
with the correct absolute path to the swift format repo.
rm /usr/local/bin/swift-format
echo "\nexport PATH=\"$PATH:/path/to/repo/.build/release\"" >> ~/.zshenv
The first removes the swift-format
binary we moved to your path of course, and the second adds the folder containing the built binary (and accompanying libraries) to your path.
You may need to restart Xcode for that to work.
from swift-format.
Sure, thx for the help @stackotter
If I add the complete path before the command, it works in xcode
/Users/zilke/Documents/swift-format/.build/release/swift-format lint -r -p --configuration formatConfig.json "${PROJECT_DIR}/ChatApp"
But the command swift-format stillt doesn't work
That is the command I tried. Just in case I did something wrong
echo "\nexport PATH=\"$PATH:/Users/zilke/Documents/swift-format/.build/release\"" >> ~/.zshenv
By mint, did you mean this project?
https://github.com/yonaskolb/Mint
Do you have any other ideas?
Is this a general problem or just in my case?
from swift-format.
If you run swift-format
in terminal does that work? The issue could be that Xcode is ignoring the new addition to the path (not sure if it respects .zshenv
, haven't used it in a while).
Mint is the only tool that I know of for installing Swift command line tools from source. There was talk about adding a swift install
command to swiftpm, but that died away sadly.
from swift-format.
Unfortunatly the command swift-format
doesn't work in the terminal.
Ok I'm going to speak to my teamleader about it.
But it is strange that it works after the installation via the brew command brew install swift-format
from swift-format.
Yeah that's strange, something weird is going on with your path. My only ideas for why that might be are: you're not using zsh (common on older macos versions), your terminal isn't causing ~/.zshenv
to be loaded (dunno why that'd be), or the path addition command I gave you failed (you should check the contents of ~/.zshenv
).
Hopefully your teamleader can help solve the issue, they should have more luck given they have access to the device 👍
from swift-format.
I'm having the same issue with XC 14.2. Other devs on my team using 14.1 have no issues with swift-format
. Any updates on this @stackotter ?
from swift-format.
@Kuro7070, you should double check your ~/.zshenv
file, checking to see if your command actually made it in. You may also have to do source ~/.zshenv
or restart your computer.
The crux of your problem is that your freshly-compiled executable isn't visible to your $PATH. Adding it to your .zshenv
should've done the trick though. (Although, I'm not actually sure what .zshenv
does...)
I would've put into my ~/.zprofile
if I wanted to modify my path (but that's not what I did).
I instead moved all relevant build artifacts to a folder I made, /Applications/Utilities/CLI/swift-format/
.
Then I symlinked the main executable like so: ln -s /Applications/Utilities/CLI/swift-format/swift-format /usr/local/bin/swift-format
.
That way I avoided messing with my $PATH, and it's a little closer to Linux conventions.
from swift-format.
@allevato thanks! 508.0.0 version is working for me!
from swift-format.
Hi guys, I tried again yesterday and now it works. I don't know why the command to change the bin folder didn't work for me the first time.
Solution:
enter this in your terminal
cp .build/release/swift-format /usr/local/bin/
cp .build/release/lib_InternalSwiftSyntaxParser.dylib /usr/local/bin/
And thank you for your help guys :)
from swift-format.
Related Issues (20)
- Whitespace removed around standalone macro with attribute HOT 3
- Cannot install swift-format via ci_post_clone.sh in Xcode cloud HOT 5
- Running swift-format in a build phase does not seem to do anything. HOT 8
- Bundle swift-format in swift's official docker image HOT 2
- Formatting not working on Windows HOT 1
- Convert `@MainActor` `XCTestCase` subclasses to have `@MainActor` on each test method? HOT 1
- Will 510.0.0 be released? HOT 8
- tag 510.0.0: "swift-format --version" prints "508.0.0" HOT 1
- OrderedImports should create separate groups for different access levels HOT 1
- Incorrect formatting for arguments following postfix `#if` HOT 1
- swift-format version 510.1.0, will it be flag as release? HOT 1
- Leading whitespace on newlines HOT 2
- `NoAccessLevelOnExtensionDeclaration` should move `@_spi` attribute with access level attribute HOT 1
- Add a rule to disallow `public` extensions while allowing `private` and `fileprivate` ones HOT 3
- Missing option to allow trailing whitespaces on blank lines HOT 1
- Whitespace removed on Macro #Preview in SwiftUI HOT 1
- Split comments if they exceed the line limit HOT 2
- Split string literals into multiple lines HOT 2
- Wrapping of long function signatures HOT 4
- `Assertion failed: Too many unresolved delimiter token lengths` for enum cases with associated values when using `prioritizeKeepingFunctionOutputTogether: true` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-format.