diff --git a/SwiftNeoVim/NeoVimAgent.m b/SwiftNeoVim/NeoVimAgent.m index c6c97e72..0b4e5526 100644 --- a/SwiftNeoVim/NeoVimAgent.m +++ b/SwiftNeoVim/NeoVimAgent.m @@ -210,8 +210,13 @@ static CFDataRef local_server_callback(CFMessagePortRef local __unused, SInt32 m _neoVimServerTask.arguments = shellArgs; [_neoVimServerTask launch]; + __auto_type listenAddress = [ + [[NSURL alloc] initFileURLWithPath:NSTemporaryDirectory()] + URLByAppendingPathComponent:[NSString stringWithFormat:@"vimr_%@.sock", _uuid] + ].path; + NSString *cmd = [NSString stringWithFormat:@"NVIM_LISTEN_ADDRESS=%@ exec \"%@\" '%@' '%@'", - [NSString stringWithFormat:@"/tmp/vimr_%@.sock", _uuid], + listenAddress, [self neoVimServerExecutablePath], [self localServerName], [self remoteServerName]]; diff --git a/SwiftNeoVim/NeoVimView.swift b/SwiftNeoVim/NeoVimView.swift index 03b5e852..e0e5a633 100644 --- a/SwiftNeoVim/NeoVimView.swift +++ b/SwiftNeoVim/NeoVimView.swift @@ -152,7 +152,9 @@ public class NeoVimView: NSView, public init(frame rect: NSRect, config: Config) { self.drawer = TextDrawer(font: self._font) self.agent = NeoVimAgent(uuid: self.uuid) - guard let nvim = Nvim(at: "/tmp/vimr_\(self.uuid).sock") else { + + let sockPath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("vimr_\(self.uuid).sock").path + guard let nvim = Nvim(at: sockPath) else { preconditionFailure("Nvim could not be instantiated") }