Command Line Tools

RSS for tag

Command line tools allow for easy installation of open source software or development on UNIX within Terminal.

Posts under Command Line Tools tag

121 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

run command line tool with associated dylib
I've been given an Xcode project which produces a command line tool which links to a dylib. I have the dylib, but not its source code. I change the signing option for the command line tool target so it is signed automatically by my personal team. On an attempt to run the tool, it fails to load the dylib, because the dylib is signed with a different certificate. I manually codesign the dylib with the same certificate I am using for the command line app. Now, I can build the app, but not run it. If I try to do so, I see four dialogs telling me “libXXX.dylib” can’t be opened because Apple cannot check it for malicious software, then the console tells me "'/path/to/libXXX.dylib' not valid for use in process: library load disallowed by system policy)" I found an old document about Gatekeeper (https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html) which suggests that Gatekeeper just won't let me do this - I can't just put the dylib next to the executable, although the dynamic linker finds the dylib, Gatekeeper doesn't like it because the dylib isn't inside the app bundle (there is none), and isn't in one of the well-known places. I dealt with this by making a do-nothing app which I can sign with my personal certificate. Then I replace the signature on the dylib (and its dependent dylibs) with my own. I add the command line tool and all its dylib dependencies to the do-nothing app, then add those files into the Copy Bundle Resources phase of the do-nothing app. Now, the command line tool and its dylibs all live in do-nothing.app/Contents/Resources, and I can run the tool from there without Gatekeeper complaining. Is there an easier way (aside from asking my supplier for static libraries)? And if this is the only way, is Contents/Resources the right place to put command line tools and the dylibs they link to?
5
0
368
1d
How to make CI build with Xcode project with automatic signing?
We have an iOS project that is configured with automatically managed signing. We cannot get automatic signing to work on our CI (GitHub Actions). To even get xcodebuild to archive we have to force it to not sign at all: xcrun xcodebuild \ -workspace app.xcworkspace \ -scheme prod \ -configuration 'Release' \ -destination generic/platform=iOS \ -archivePath ./build/prod.xcarchive \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGNING_ALLOWED=NO \ clean archive All our attempts to make xcodebuild archive do manual signing have failed. In order to have the app properly signed with the right entitlements we then call codesign: codesign -f \ -s Distribution \ --entitlements prod.entitlements \ ./build/prod.xcarchive/Products/Applications/prod.app Then we export the ipa: xcrun xcodebuild \ -exportArchive \ -archivePath ./build \ -exportOptionsPlist exportOptions.plist \ -exportPath ./build This seems to work so my question is: Is it supported to do manual signing this way? Is there a better way? If we omit the codesign step, the app will still be signed - by exportArchive we assume, but then the entitlements are missing.
2
0
159
2d
Slow incremental build times with xcodebuild command
When I compile my Xcode project using the xcodebuild command, I observe long incremental build durations. For example, compiling a new, empty project in Xcode only takes around one second. The same project takes 7 seconds to compile using the xcodebuild command. I've noticed that xcodebuild hangs at the "GatherProvisioningInputs" phase. Steps to Reproduce: Create a new Xcode project (iOS app template) Build the project in Xcode with timing summary enabled Build the same project from the command line with the following command: time xcodebuild -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' I would appreciate any insights or suggestions on how to improve the build times when using the xcodebuild command. Thank you in advance for your help!
0
0
74
3d
spacial computing
Hello, I've test Apple spacial computing since few weeks now. I've hope working on spacial computer will give me more productive. At this time, safari extensions I use (bitwarden) was not available. There is no other web browser available. I've not find how to use xcode in my spacial computer. I've not find any native (not iPad) terminal tool. Mac screen sharing only give me one screen (and I've got 4 in my desk). This screen can be very big but I prefer having 4 little screen better a big one. And screen sharing is not usable using mouse at all. my mouse always disapear from my screen when sharing with my spacial computer. For all theses case, using spacial computing for working is not realist at this time in my specific case. I lost to many time using it instead of using a "real" computer. Hope this message can help you to upgrade software and give me all tools needed to use it to work. Best regards, Julien Boquet
0
0
130
1w
Setting Display Colour Profiles via terminal
Hi, I'm looking at being able to set a display colour profile via terminal. I know apps such as SwitchResX are able to change this but i can't figure out how and if it is possible to switch via a terminal command or via a script. This here is what i would like to change. I have googled about and searched through preference files but can't find anything. Any help is much apreciated. Thanks, James
0
0
154
3w
dyld not searching in /usr/local/lib (cmd line tools 2397)
It seems impossible to me, but around the time I installed the latest command line tools (xcode-select version 2397) binaries what were built with linkages to @rpath/libfoo.dyld stopped being able to find their dependency. The error looks like this. dyld[1471]: Symbol not found: _GEOSGeomGetX Referenced from: <16DBE67F-CB32-31EE-BCE0-BFB58EEC9740> /Users/pramsey/tmp/capi_indexed_predicate Expected in: <no uuid> unknown zsh: abort ./capi_indexed_predicate If I turn on DYLD_PRINT_SEARCHING, I can see the linker giving up on the rpath entry. dyld[1501]: find path "@rpath/libgeos_c.1.dylib" dyld[1501]: not found: "@rpath/libgeos_c.1.dylib" I can work around, partially, by setting DYLD_LIBRARY_FALLBACK_PATH to have /usr/local/lib in it, but that is only a partial fix, because SIP will strip that variable for any child processes, which means most of my development and database work is borked. This seems like a very new quirk, maybe related to the XCode 15 update, at least in my personal time line, has anyone else seen it, or have any clue as to what has changed? (Worth noting, nothing changed in my code, just one day my builds wouldn't run anymore, and that day was the day after I had installed the new commandline tools).
15
5
2.5k
3w
defaults tool can't handle app group settings?
I have an app group to share settings between a main app and a helper. This is accessed using [[NSUserDefaults alloc] initWithSuiteName: @"FDHC2KMZ6V.com.jwwalker.autopairs.suite"]. What's puzzling me is that if I go to Terminal and enter defaults read FDHC2KMZ6V.com.jwwalker.autopairs.suite it tells me that the domain does not exist. Is this a bug in the defaults tool, or is there some trick I'm missing?
4
1
581
3w
profiles command
I'm working on a tool which parses the output from the command "profiles -P -o" to check that our MDM profile has been deployed correctly, as there has been issues around profiles being misconfigured. It seems that the framework which the profiles command uses is private, so I'm just wondering could there be a way to get information which is similar to the output from the profiles command without having to directly use the command?
1
0
164
May ’24
How do I Developer ID-sign and export a macOS app with an entitlement through the command-line without being signed in with my Apple ID in Xcode?
Hi, I'm trying to Developer ID-sign and export a macOS app through my CI/CD pipeline on GitHub Actions, but I've run into an issue signing my app once it has one or more entitlements, in this case, an app group entitlement. I'm using xcodebuild to archive the app and export that archive, signing it along the way. This works fine as long as my app does not have an entitlement, but once it has an entitlement, exporting the archive fails. To elaborate a bit on this, I first make sure the development certificate and the Developer ID certificate are installed on the machine. These are installed using the security CLI, and I'm confident that they are installed correctly. Then I proceed to archive the app using xcodebuild as shown below. xcodebuild archive\ -scheme MyApp\ -configuration Release\ -sdk macosx\ -archivePath MyApp.xcarchive\ -destination "platform=OS X,arch=x86_64"\ -allowProvisioningUpdates\ -authenticationKeyIssuerID XYZ1234\ -authenticationKeyID XYZ\ -authenticationKeyPath AuthKey.p8 Then I export the archive using xcodebuild as shown below. xcodebuild -exportArchive\ -archivePath MyApp.xcarchive\ -exportPath export\ -exportOptionsPlist ExportOptions.plist\ -allowProvisioningUpdates\ -authenticationKeyIssuerID XYZ1234\ -authenticationKeyID XYZ\ -authenticationKeyPath AuthKey.p8 When my app has one or more entitlements, this fails with the following error message: Error: error: exportArchive: Cloud signing permission error Error: error: exportArchive: No profiles for 'com.example.MyApp' were found Note that I am not signed into an Apple ID in Xcode when signing and exporting my app through my CI/CD pipeline, as there does not seem to be a way to sign into an Apple ID in Xcode through the CLI. Instead, I'm authenticating with an App Store Connect API key. Developer ID-signing and exporting my app does work when I do it through Xcode, even if the app has an entitlement, so the signing of the app is configured correctly. Upon inspecting the contents of ~/Library/MobileDevice/Provisioning Profiles after signing and exporting the app through Xcode, I notice that Xcode automatically creates two provisioning profiles with the titles: Mac Team Provisioning Profile: com.example.MyApp Mac Team Direct Provisioning Profile: com.example.MyApp These two provisioning profiles are not created when signing and exporting the app through the xcodebuild command-line tool, and I suspect that is part of the problem. I'd be OK with manually creating these provisioning profiles through Apple's developer portal and installing them as part of my CI/CD pipeline, but I can't seem to find a way to create this type of provisioning profile through the portal. Neither the macOS App Development, Mac App Store Connect, nor Developer ID provisioning profile types yield this kind of provisioning profile. All of this, leaves me with the question: How do I Developer ID-sign and export a macOS app with an entitlement through the command-line without being signed in with my Apple ID in Xcode?
4
0
632
Apr ’24
Xcode CommandLineTools
OS :14.4.0 xcode version 2406 I installed CommandLineTolols by using below command xcode-select --install I checeked the installtion with xcode-select -p and got expecetd output /Library/Developer/CommandLineTools now if I do this sudo xcode-select --switch /Library/Developer/CommandLineTools there is no change in the promt % to $ which suppose to be happen. Am I right? I am now in mac world. How do I know CommandLineToos running? Please help
1
0
290
Apr ’24
Xcode 15.3, use xcodebuild to build app, error: "TARGET" requires a provisioning profile xxxxx
Everything is ok util upgrade to xcode15.3 and macos14.0. When I usexcodebuild to build my app, some error occured: error: "ShopAssistant" requires a provisioning profile with the Associated Domains, Push Notifications, and Sign in with Apple features. Select a provisioning profile in the Signing &amp; Capabilities editor. (in target 'ShopAssistant' from project 'ShopAssistant') But, just use Xcode menu Product/Archive is ok. I need to use command line in our CI/CD system. Hope somebody can help me. Terminal Log Details: xcodebuild -project ShopAssistant.xcodeproj -scheme ShopAssistant -sdk iphoneos -configuration Release archive Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project ShopAssistant.xcodeproj -scheme ShopAssistant -sdk iphoneos -configuration Release archive User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES Build settings from command line: SDKROOT = iphoneos17.4 --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device } { platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00008103-0009489814FB001E, name:My Mac } { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device } { platform:iOS Simulator, id:E06C0B90-67C7-449D-981E-0BFEEDF77160, OS:17.4, name:iPad (10th generation) } { platform:iOS Simulator, id:E06C0B90-67C7-449D-981E-0BFEEDF77160, OS:17.4, name:iPad (10th generation) } { platform:iOS Simulator, id:35BC8560-1097-4751-A0F5-F6DC0B4C84DE, OS:17.4, name:iPad Air (5th generation) } { platform:iOS Simulator, id:35BC8560-1097-4751-A0F5-F6DC0B4C84DE, OS:17.4, name:iPad Air (5th generation) } { platform:iOS Simulator, id:1150700F-45CA-42E4-8D8B-8E70C849886E, OS:17.4, name:iPad Pro (11-inch) (4th generation) } { platform:iOS Simulator, id:1150700F-45CA-42E4-8D8B-8E70C849886E, OS:17.4, name:iPad Pro (11-inch) (4th generation) } { platform:iOS Simulator, id:5BA4C379-2462-449F-9D93-5D64DED7422E, OS:17.4, name:iPad Pro (12.9-inch) (6th generation) } { platform:iOS Simulator, id:5BA4C379-2462-449F-9D93-5D64DED7422E, OS:17.4, name:iPad Pro (12.9-inch) (6th generation) } { platform:iOS Simulator, id:F2F80E23-7C33-4965-806D-EC56962ECE54, OS:17.4, name:iPad mini (6th generation) } { platform:iOS Simulator, id:F2F80E23-7C33-4965-806D-EC56962ECE54, OS:17.4, name:iPad mini (6th generation) } { platform:iOS Simulator, id:C5A161D8-1D8B-499A-BB27-3B630002CE25, OS:17.4, name:iPhone 15 } { platform:iOS Simulator, id:C5A161D8-1D8B-499A-BB27-3B630002CE25, OS:17.4, name:iPhone 15 } { platform:iOS Simulator, id:995C11EA-5ACF-4A1A-9FFC-DF0A0AEE63F2, OS:17.4, name:iPhone 15 Plus } { platform:iOS Simulator, id:995C11EA-5ACF-4A1A-9FFC-DF0A0AEE63F2, OS:17.4, name:iPhone 15 Plus } { platform:iOS Simulator, id:3A444CC6-16B1-4F79-8144-7A5BB23FD1BA, OS:17.4, name:iPhone 15 Pro } { platform:iOS Simulator, id:3A444CC6-16B1-4F79-8144-7A5BB23FD1BA, OS:17.4, name:iPhone 15 Pro } { platform:iOS Simulator, id:D30229CD-1D9E-4206-980E-70A5208E5193, OS:17.4, name:iPhone 15 Pro Max } { platform:iOS Simulator, id:D30229CD-1D9E-4206-980E-70A5208E5193, OS:17.4, name:iPhone 15 Pro Max } { platform:iOS Simulator, id:3C53C988-D93B-4E38-AC9F-BE8B8F111280, OS:17.4, name:iPhone SE (3rd generation) } { platform:iOS Simulator, id:3C53C988-D93B-4E38-AC9F-BE8B8F111280, OS:17.4, name:iPhone SE (3rd generation) } Prepare packages ComputeTargetDependencyGraph note: Building targets in dependency order note: Target dependency graph (1 target) Target 'ShopAssistant' in project 'ShopAssistant' (no dependencies) GatherProvisioningInputs CreateBuildDescription ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk -x objective-c -c /dev/null ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk -x c -c /dev/null ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --version --output-format xml1 ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Users/es/ShopAssistant_3.7.9/shopassistant_native_ios_pure/930714_0_4.9.3/Assistant/Images.xcassets ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/usr/bin/actool --version --output-format xml1 ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -v ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk -x c -c /dev/null ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -version_details Build description signature: xxxxxxx Build description path: /Users/es/Library/Developer/Xcode/DerivedData/ShopAssistant-cmrxpudshqxyfcgqsharjobmjuxt/Build/Intermediates.noindex/ArchiveIntermediates/ShopAssistant/IntermediateBuildFilesPath/XCBuildData/xxxxxx.xcbuilddata /Users/ShopAssistant.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'ShopAssistant' from project 'ShopAssistant') /Users/ShopAssistant.xcodeproj: error: "ShopAssistant" requires a provisioning profile with the Associated Domains, Push Notifications, and Sign in with Apple features. Select a provisioning profile in the Signing &amp; Capabilities editor. (in target 'ShopAssistant' from project 'ShopAssistant') ** ARCHIVE FAILED **
0
0
540
Apr ’24
Vim creating additional files when creating/editing .txt file
I'm learning to use Vim in Xcode and within Terminal. I've used VimTutor to learn the basics. The issue I've run into when creating a text file is additional, garbage files being created whenever I create or edit a .txt file - vim index.txt produces the following: How do I prevent vim from creating the .index.html.un~ and index.html~ files? It's annoying me and git. Thanks, jake
1
0
290
Apr ’24
Add Script to Dock
Hi All, I created a live script and I was hoping to be able to pin it as a shortcut on the dock. Currently the only way I can launch it is by opening terminal and calling the script. Is there any way to have it added to the dock so I can just click on it and have it launch? Thanks for any input.
2
0
282
Mar ’24
Make my app quit and reopen when updating it with .pkg
Context: Our app has a network system extension. After updating it via MDM sometimes the app and the extension have different versions until you restart the app. I suspect that it is because the app is not quit before installing. As a fix I am trying to create a .pkg with preinstall and postinstall script, that would close the app before installation and open it after installation. My code: FileUtils.mkdir_p("install_scripts") File.open('install_scripts/preinstall', 'w') do |file| file.puts "#!/bin/bash\nosascript -e 'quit app \"#{options[:app_name]}\"'\nexit 0" end File.open('install_scripts/postinstall', 'w') do |file| file.puts "#!/bin/bash\nopen -a '#{options[:app_name]}'\nexit 0'" end sh "chmod a+x install_scripts/preinstall" sh "chmod a+x install_scripts/postinstall" sh( "pkgbuild", "--scripts", "install_scripts", "--identifier", ***_identifier(options), "--component", "../#{options[:build_path]}/#{options[:app_name]}.app", "--install-location", "/Applications/#{options[:app_name]}.app", "Distribution.pkg" ) sh( "productbuild", "--synthesize", "--package", "Distribution.pkg", "Distribution.xml" ) sh( "productbuild", "--distribution", "Distribution.xml", "--sign", "Developer ID Installer: *** Inc. (#{ENV["APPLE_TEAM_ID"]})", "--package-path", ".", "../artifacts/#{options[:app_name]}.pkg" ) Issue: I haven't got it to actually install the app or to close or open the running app. I've tried several changes. The code above fails with this error. Do you see an issue in my code, or could you point me to alternative implementation? installd[1101]: PackageKit: Install Failed: Error Domain=NSCocoaErrorDomain Code=516 ""Myapp Dev.app" couldn't be moved to "Applications" because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Library/InstallerSandboxes/.PKInstallSandboxManager/8E84CB81-4724-4D4E-BE76-3A24DECC60A6.activeSandbox/Root/Applications/Myapp Dev.app/Myapp Dev.app, NSUserStringVariant=( Move ), NSDestinationFilePath=/Library/InstallerSandboxes/.PKInstallSandboxManager/8E84CB81-4724-4D4E-BE76-3A24DECC60A6.activeSandbox/Root/Applications/Myapp Dev.app, NSFilePath=/Library/InstallerSandboxes/.PKInstallSandboxManager/8E84CB81-4724-4D4E-BE76-3A24DECC60A6.activeSandbox/Root/Applications/Myapp Dev.app/Myapp Dev.app, NSUnderlyingError=0x117e304b0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}} { NSDestinationFilePath = "/Library/InstallerSandboxes/.PKInstallSandboxManager/8E84CB81-4724-4D4E-BE76-3A24DECC60A6.activeSandbox/Root/Applications/Myapp Dev.app"; NSFilePath = "/Library/InstallerSandboxes/.PKInstallSandboxManager/8E84CB81-4724-4D4E-BE76-3A24DECC60A6.activeSandbox/Root/Applications/Myapp Dev.app/Myapp Dev.app"; NSSourceFilePathErrorKey = "/Library/InstallerSandboxes/.PKInstallSandboxManager/8E84CB81-4724-4D4E-BE76-3A24DECC60A6.activeSandbox/Root/Applications/Myapp Dev.app/Myapp Dev.app"; NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=17 "File exists""; NSUserStringVariant = ( Move ); }
2
0
336
Mar ’24
building for iOS, but linking in object file built for macOS, file 'btfs.a' for architecture arm64
Hello there, I'm struggling with the following issue since Xcode 15 arrived and haven't been able to solve it. I have a go library c-archive library which I'm using in a iOS app and build were OK until Sonoma updated came last year. I updated all my go libraries and go runtime to latest version and still facing issues: my make script as follows: ios-arm64: CGO_ENABLED=1 GOOS=ios GOARCH=arm64 SDK=iphoneos SDK_PATH=xcrun --sdk iphoneos --show-sdk-path CARCH="arm64" CC=$(PWD)/clangwrap.sh CGO_CFLAGS="-fembed-bitcode" go build -v -buildmode=c-archive -ldflags="-s -w" -gcflags=all="-l -B" -tags ios -o $(IOS_OUT)/btfs.a . If there is anything else you need I can share more details. Thanks!
1
0
357
Mar ’24
Files in pkgbuild installer component don't follow relocatable bundle
I have an app that requires to install itself as a folder along with a few support files. So I've defined a package component that installs itself somewhat like so: /Applications/MyApp/MyApp.app /Applications/MyApp/Foo /Applications/MyApp/Barr The application require those other files be in place to operate. In order to make the installer requirement hurt a bit less in a world of drag and drop single bundle Mac apps - I'd like the support relocation so the user can move this folder wherever the like. However - if I enable relocation - only the application bundle is relocated. The sidecar files continue installing to /Applications/MyApp. Is there any way to get the companion files to relocate along with the application bundle?
0
0
321
Mar ’24
Xcode 15.3 broke agvtool version management
The new version of Xcode 15.3 broke the behavior of incrementing build numbers with agvtool which I used to automate to update the build number after each build. The observation is that after running this in my project directory: agvtool bump Xcode removed the section "Package Dependencies" in the project navigation pane which results in failing a subsequent build with this error message: Missing package product 'mypackage' To solve this I have to reset package caches under File>Packages. This will restore the Package Dependencies section in the navigation pane of Xcode. It seems to be a bug of the new Xcode version 15.3 as this was working without any issues in the previous versions. Any idea?
3
1
639
Mar ’24