commit 359ac11fd5dc9600aeeaec22d8f21b53c34b7bcd
parent 1cd37d594e62ff4c70708d1caba92e65d6490d98
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 7 Jul 2026 19:28:30 +0900
nvim: look up Xcode SDK paths dynamically
This way, if you have multiple Xcode version installed at paths like
/Applications/Xcode26.6.app etc. we can still find what we need using
the currently xcode-select'ed Xcode.
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/.config/nvim/lua/plugins/languages.lua b/.config/nvim/lua/plugins/languages.lua
@@ -1,13 +1,19 @@
--- Sourcekit SDK map.
+local function get_sdk_path(sdk)
+ return vim.fn.system('xcrun --show-sdk-path --sdk ' .. sdk):gsub('\n', '')
+end
+local function get_platform_path(sdk)
+ return vim.fn.system('xcrun --show-sdk-platform-path --sdk ' .. sdk):gsub('\n', '')
+end
+
local sdk_map = {
iOS = {
- platform = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform',
- path = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk',
+ platform = get_platform_path('iphoneos'),
+ path = get_sdk_path('iphoneos'),
target = 'arm64-apple-ios13.0'
},
macOS = {
- platform = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform',
- path = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk',
+ platform = get_platform_path('macosx'),
+ path = get_sdk_path('macosx'),
target = 'arm64-apple-macosx10.15'
}
}