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

91 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Apple ID dissapears from Xcode and build is failing
I'm calling this command to export archive: xcodebuild -exportArchive -archivePath .build/XYZ.xcarchive -exportPath .build/XYZ.ipa -exportOptionsPlist Authenticator/ExportOptions.plist -quiet -allowProvisioningUpdates Here is my exportOptions file content <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>method</key> <string>app-store-connect</string> <key>signingStyle</key> <string>automatic</string> <key>teamID</key> <string>ABCD</string> </dict> </plist> Most of the time this command fail with this error: error: exportArchive No Accounts error: exportArchive No signing certificate "iOS Distribution" found What we found is that our Apple ID just disappear from Xcode and we need to add it again manually. So there are two questions here: Why Apple ID account dissapears and how I can fix this? Is there an option to not use Apple ID account in Xcode and for example to use -authenticationKeyID flags of xcodebuild? Just to mention this happens only on our CI machine and not locally.
0
0
143
1w
Xcode 16.2 Framework Signing Issues with Cloud Managed Developer ID in Automated Builds
Xcode 16.2 Framework Signing Issues with Cloud Managed Developer ID in Automated Builds Issue Description After upgrading from Xcode 15.4 to 16.2, our macOS app's frameworks are failing notarization with the error "The binary is not signed with a valid Developer ID certificate" for embedded frameworks when building through fastlane. This worked correctly in Xcode 15.4. Importantly, manually archiving and notarizing through the Xcode GUI still works correctly - the issue only occurs during automated builds. Build Configuration We use fastlane to build and notarize our macOS app: build_mac_app( scheme: 'Runner', export_method: "developer-id", xcargs: '-allowProvisioningUpdates' ) This generates the following xcodebuild commands: Archive: xcodebuild -workspace ./Runner.xcworkspace -scheme Runner -destination 'generic/platform=macOS' -archivePath /path/to/archive -allowProvisioningUpdates archive Export with plist: xcrun -exportArchive -exportOptionsPlist '/path/to/plist' -archivePath /path/to/archive -exportPath '/output/path' -allowProvisioningUpdates Export options plist contents: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>installerSigningCertificate</key> <string>Developer ID Installer: Company Inc (1234567891)</string> <key>method</key> <string>developer-id</string> <key>signingStyle</key> <string>automatic</string> </dict> </plist> Notarization: ditto -c -k --rsrc --keepParent "My App.app" "My App.app.zip" xcrun notarytool submit "My App.app.zip" --output-format json --wait --key /path/to/key --key-id ABCDEFGHIJ --issuer 12345678-abcd-1234-5678-fc2d96b1735a Error Output Notarization fails with the following errors: { "severity": "error", "code": null, "path": "My App.app.zip/My App.app/Contents/Frameworks/some_package.framework/Versions/A/some_package", "message": "The binary is not signed with a valid Developer ID certificate.", "docUrl": "https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues#3087721", "architecture": "arm64" } Key Details Using Xcode Cloud managed Developer ID certificates (not local certificates) ✅ Building, archiving, and notarizing through Xcode GUI works correctly Automatic signing is enabled Expected Behavior Frameworks should be automatically signed with the cloud managed Developer ID certificate during the export process, as they were in Xcode 15.4. Has there been a change in how framework signing is handled with cloud managed certificates in Xcode 16.2's command line tools? Any guidance on how to ensure frameworks are properly signed during automated builds when using automatic signing with cloud managed Developer ID certificates would be appreciated.
1
3
264
5d
Getting GTK auto complete/syntax highlighting to work on emacs on macOS
I recently wrote an article on getting gtk auto complete/syntax highlighting on macOS its a genuinely fun hobby to make portable software, and this method will ultimately help in porting software to the macOS platform a copy and paste: before I continue, I want to mention that emacs auto completion, using company-mode, is rather slow when it comes to parsing a ton files, and in some configurations, especially recursively when it comes to parsing and displaying functions and macros, even when using the semantic auto complete system, but I do believe it speeds up when you initially parse and save to ctags or when you build a semanticdb, functions such as g_signal_connect() and macros such as G_APPLICATION however, did not work with company modes auto complete, but worked with flycheck on the fly syntax checking, using this method, and I haven’t had time to perfect an emacs configuration; maybe some time next week you will need gtk installed from brew or ports, since gtk has trouble compiling from source on some Mac configurations. this method works with whatever version of gtk is reported by pkg-config –cflags (pkg-config --cflags gtk. you will also need pkg-config installed, multiple installations of gtk can be used and utilized but the emacs plugins you’ll need are (and you’ll need to connect to Melpa using list-packages https://melpa.org/#/getting-started to have these automatically downloaded and configured): company company-c-headers flycheck flycheck-pkg-config exec-path-from-shell (this allows x11emacs to read the shells configuration, may be option for terminal based emac uses) optional: function-args-mode, but when fa-show-auto is used, it breaks themes in emacs download all of them through M-x list-packages (which means pressing alt+x, macOS option+x, which should issue an input on the bottom of emacs, where the status bar is), after that, type list-packages or use auto completion, aka ctrl+tab to cycle through possible candidates open a c file (C-f ~/test.c) (which is control+x, macOS control+x) type in: M-x semantic-mode M-x semantic-customize-system-include-path in semantic-customize-system-include-path, add the path to the gtk version you intend to develop for, in my case /opt/homebrew/Cellar/gtk4/4.16.12/include/gtk-4.0 using the text based interface; you should be able to use your mouse (click ins after where it says /usr/include. semantic is included in emacs. options are automatically saved at command) M-x exec-path-from-shell-initialize M-x flycheck-mode M-x flycheck-pkg-config in flycheck-pkg-config, press enter, and then type the name of the version of gtk that provides valid input from pkg-config (ie gtk4) M-x global-company-mode if you need to bind ctrl+tab to auto complete, you can add this to your config (~/.emacs.d/init.el) (global-set-key (kbd “C-”) ‘company-semantic) this will do most of the grunt work when plugins are installed (ctrl-tab shows a window to auto complete, ctrl+` (thats the key before 1, with shift it becomes ~) shows function argument. fa-show-auto automatically shows function prototypes, but can break emacs themes: (require ‘package) (add-to-list ‘package-archives ‘(“melpa” . “https://melpa.org/packages/”) t) ;; Comment/uncomment this line to enable MELPA Stable if desired. See package-archive-priorities ;; and package-pinned-packages. Most users will not need or want to do this. ;;(add-to-list ‘package-archives ‘(“melpa-stable” . “https://stable.melpa.org/packages/”) t) (package-initialize) (global-company-mode t) (global-flycheck-mode t) (semantic-mode t) (function-args-mode) (global-company-mode t) (global-flycheck-mode t) (semantic-mode t) (function-args-mode) (global-set-key (kbd “C-”) ‘company-semantic) (global-set-key (kbd “C-`”) ‘fa-show) if you need to compile from inside emacs, I would make a Makefile according to the gtk tutorial on gtk.org I also have another article on getting Xcode to work with gtk, which is more reliable: https://unix-world.com/2025/01/25/getting-gtk4-to-work-in-xcode-with-auto-complete-and-syntax-highlighting/ website is unix-world.com and I welcome any and all traffic !
0
0
98
1w
GPTK did not build error
Hey there, I tried to install GPTK again, since I had to reinstall the OS for irrelevant reasons. But every time I try to install the tool kit, it gives me theError: apple/apple/game-porting-toolkit 1.1 did not build error. Before that error occired, I had the Openssl error, which I fixed with the rbenv version of openssl. Is there any way to fix this error? Down bellow you'll find the full error message it gave me. The specs for my Mac are (if they are helpful in any way): M1 Pro MBP 14" with 16GB Ram and 512GB SSD. Thanks! ``Error: apple/apple/game-porting-toolkit 1.1 did not build Logs: /Users/myuser/Library/Logs/Homebrew/game-porting-toolkit/00.options.out /Users/myuser/Library/Logs/Homebrew/game-porting-toolkit/01.configure /Users/myuser/Library/Logs/Homebrew/game-porting-toolkit/01.configure.cc /Users/myuser/Library/Logs/Homebrew/game-porting-toolkit/wine64-build If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core): https://github.com/apple/homebrew-apple/issues```
0
0
299
2w
diskutil "eraseDisk" on disk0 using terminal
Hi Apple Team & Everyone, Can someone guide me why sending 'diskutil eraseDisk APFS "WIPED" GPT /dev/disk0' command via terminal to remove/wipe the main physical drive (disk0) is failed? I tried booting into recovery mode, but it still didn’t work. The command returned the following error: Started erase on disk0 Unmounting disk The volume on disk0 couldn't be unmounted because it is in use by process 0 (kernel). Error: -69877: Couldn't open device I understand that we can use Disk Utility (GUI) to unmount and erase the drive. Is it possible to perform this operation via Terminal to erase disk0? I would appreciate any guidance on this. Regards, Winson
2
0
200
2w
command executed via `ssh machine bash -c "..."` does not have access to /Volumes
The simple test case is this: @max[git:master]$ /usr/bin/ssh max ls /Volumes Macintosh HD TM2 me me9 @max[git:master]$ and @max[git:master]$ /usr/bin/ssh max /bin/bash -c "ls /Volumes" Applications Calibre Library Desktop ... The latter is NOT doing an ls of /Volumes/ but of my $HOME directory. This is a recent change. I've had a script that is > 10 years old that just started failing. Here's another look: @max[git:master]$ /usr/bin/ssh max /bin/bash -c "cd /Volumes && pwd" /Users/layer @max[git:master]$ echo $? 0 @max[git:master]$ It's weird that it just silently ignores the cd. This is on ProductVersion: 15.3 BuildVersion: 24D60
2
0
249
3w
Xcode 16.2 crashes while resolving dependencies
After upgrading to xcode 16.2 I see the following crash when resolving dependencies via command line: ** INTERNAL ERROR: Unable to load workspace '....' ** Uncaught Exception: *** -[NSMutableArray insertObjects:atIndexes:]: count of array (15) differs from count of index set (14) Stack: 0 __exceptionPreprocess (in CoreFoundation) 1 objc_exception_throw (in libobjc.A.dylib) 2 -[__NSCFString characterAtIndex:].cold.1 (in CoreFoundation) 3 -[NSMutableArray insertObjects:atIndexes:] (in CoreFoundation) 4 __50-[IDEGroup insertGroupSubitems:atIndexes:context:]_block_invoke (in IDEFoundation) 5 -[DVTModelObjectGraph performBlockCoalescingModelChanges:] (in DVTFoundation) 6 -[IDEGroup insertGroupSubitems:atIndexes:context:] (in IDEFoundation) 7 -[NSMutableArray(DVTFoundationClassAdditions) dvt_sortedInsertOfObjects:withComparator:] (in DVTFoundation) 8 specialized IDESPMWorkspaceDelegate.registerDependencyFileReferences(_:modelGraphSynchronizerToken:) (in IDESwiftPackageCore) 9 specialized IDESPMWorkspaceDelegate.dependencyPackagesDidUpdate(packages:graphHasErrors:revalidatedFilePathCaches:modelGraphSynchronizerToken:) (in IDESwiftPackageCore) 10 closure #1 in IDESPMWorkspaceDelegate.packageGraphDidFinishAction(_:duration:result:) (in IDESwiftPackageCore) 11 partial apply for closure #1 in IDESPMWorkspaceDelegate.disableWorkspaceContentSynchronization(during:) (in IDESwiftPackageCore) 12 closure #1 in DVTModelObjectGraph.performBlockCoalescingModelChanges<A>(_:) (in DVTFoundation) 13 thunk for @callee_guaranteed () -> (@owned [String : NSObject]) (in DVTFoundation) 14 thunk for @escaping @callee_guaranteed () -> () (in DVTFoundation) 15 __58-[DVTModelObjectGraph performBlockCoalescingModelChanges:]_block_invoke (in DVTFoundation) 16 -[DVTModelGraphTransactionScope performTransaction:] (in DVTFoundation) 17 -[DVTModelObjectGraph performBlockCoalescingModelChanges:] (in DVTFoundation) 18 DVTModelObjectGraph.performBlockCoalescingModelChanges<A>(_:) (in DVTFoundation) 19 IDESPMWorkspaceDelegate.disableWorkspaceContentSynchronization(during:) (in IDESwiftPackageCore) 20 IDESPMWorkspaceDelegate.packageGraphDidFinishAction(_:duration:result:) (in IDESwiftPackageCore) 21 partial apply for thunk for @escaping @isolated(any) @callee_guaranteed @async () -> () (in IDESwiftPackageCore) 22 SPMWorkspace.packageGraphActionFinished(_:) (in SwiftPM) 23 closure #2 in closure #3 in SPMWorkspace.processPackageGraphActionsInBackgroundIfNeeded(canProcessPackageGraphActions:) (in SwiftPM) 24 dispatch thunk of SPMWorkspaceOrchestrationDelegate.packageGraphDidFinishAction(_:duration:result:) (in SwiftPM) 25 specialized thunk for @escaping @isolated(any) @callee_guaranteed @async () -> (@out A) (in SwiftPM) 26 partial apply for specialized thunk for @escaping @isolated(any) @callee_guaranteed @async () -> (@out A) (in SwiftPM) 27 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) (in libswift_Concurrency.dylib) sh: line 1: 24112 Abort trap: 6 env NSUnbufferedIO=YES xcodebuild -scheme ***-Package -destination 'platform=iOS Simulator,id=950768B8-85B4-4250-A7EC-5AE8758369EE' -derivedDataPath .DerivedData -resultBundlePath '/.../***-Package.xcresult' -enableCodeCoverage YES -skipPackagePluginValidation -skipMacroValidation -disablePackageRepositoryCache build test``` Are there any workaround for this?
4
1
360
3w
Xcode Command Responses
Hi Developer Forums, I'm a sys admin trying to help an Xcode user. If I'm on Sequoia with the latest version of Xcode and XCode command line tools, should I see responses in Terminal for the commands below when executed in Terminal: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch sudo xcodebuild -checkFirstLaunchStatus Thanks in advance, az
1
0
235
Jan ’25
Change recording mode when using xctrace
Hey, In the UI of the Instruments app, I can change the recording mode to immediate. Is that possible when using xctrace? It seems to use deferred as a default. I've tried to create a template, set the recording mode to immediate, and use that template for recording. However, that doesn't seem to work. At least the exported TOC of the .trace will have the following summary: <summary> <start-date>2025-01-11T13:00:11.365+01:00</start-date> <end-date>2025-01-11T13:00:30.525+01:00</end-date> <duration>19.160279</duration> <end-reason>Target app exited</end-reason> <instruments-version>16.0 (16A242d)</instruments-version> <template-name>core_animation_fps</template-name> <recording-mode>Deferred</recording-mode> <time-limit>12 hours</time-limit> </summary> This issue might be related to: https://developer.apple.com/forums/thread/735948 Thanks a lot!
3
0
295
Jan ’25
Command Line Tool doesn't trigger permission prompt for audio recording
Hello, I'm developing a Command Line Tool in XCode, in order to capture system audio and save it to a file, which will then be used by a separate process. Everything works perfectly when running it from either XCode or the native terminal application (see image below), but as soon as I try to run it from any 3rd party application, it doesn't ask for permissions to record sound, and the resultant file ends up soundless. When archiving it and then running it from other 3rd party applications, e.g Warp (terminal) or spawning it as a child process from a bundled Electron application, it doesn't ask for permissions. Things of note: I've codesigned the application with "Developer ID Application" I've added NSAudioCaptureUsageDescriptionto Info.plist I've included Info.plist in the binary (see image below) I've added the com.apple.security.device.audio-input entitlement I've used the following resources as inspiration: https://github.com/insidegui/AudioCap https://developer.apple.com/documentation/coreaudio/capturing-system-audio-with-core-audio-taps As my use-case involves spawning the executable from Electron as a child process, I've tried to include the appropriate permissions to the parent application too, without success. I'm really at a loss here, it feels like I've tried everything. Any pointers are much appreciated! Thanks
2
0
388
Dec ’24
installing a SMAppService based LaunchDaemon from the command line
our app has a helper to perform privileged operations. previously that helper was installed via SMJobBless() into the /Library/LaunchDaemons/ and /Library/PrivilegedHelperTools/ we also had a script that would install the helper from the command-line, which was essential for enterprise users that could not manually install the helper on all their employee's Macs. the script would copy the files to their install location and would use launchctl bootstrap system as the CLI alternative to SMJobBless(). the full script is here: https://pastebin.com/FkzuAWwV due to various issues with the old SMJobBless() approach we have ported to helper to the new SMAppService API where the helpers do not need to be installed but remain within the app bundle ( [[SMAppService daemonServiceWithPlistName:HELPER_PLIST_NAME] registerAndReturnError:&err] ) however, we are having trouble writing a (remote-capable) CLI script to bootstrap the new helper for those users that need to install the helper on many Macs at once. running the trivial sudo launchctl bootstrap system /Applications/MacUpdater.app/Contents/Library/LaunchDaemons/com.corecode.MacUpdaterPrivilegedInstallHelperTool2.plist would just result in a non-informative: Bootstrap failed: 5: Input/output error various other tries with launchctl bootstrap/kickstart/enable yielded nothing promising. so, whats the command-line way to install a SMAppService based helper daemon? obviously 'installing' means both 'registering' (which we do with registerAndReturnError in the GUI app) and 'approving' (which a GUI user needs to manually do by clicking on the notification or by going into System Settings). thanks in advance! p.s. we wanted to submit this as a DTS TSI, but those are no longer available without spending another day on a reduced sample projects. words fail me. p.p.s. bonus points for a CLI way to give FDA permissions to the app!
3
1
414
Jan ’25
Has `xcodebuild -showdestinations` been changed since macOS Sequoia?
Hi, I just upgraded MBP M3 Pro and mac mini M1/M2 to macOS 15.1 Sequoia and these macs not showing its available destination candidates after update. DEVELOPER_DIR=`xcode-select -p` xcodebuild -scheme myapp -derivedDataPath ./derived_data -showdestinations Command line invocation: /Applications/Xcode/Xcode_16.2.app/Contents/Developer/usr/bin/xcodebuild -scheme myapp -derivedDataPath derived_data -showdestinations User defaults from command line: IDEDerivedDataPathOverride = /path/to/myapp/derived_data IDEPackageSupportUseBuiltinSCM = YES Available destinations for the "approduce_calc_v2" scheme: { platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00006020-001971C422C3C01E, name:My Mac } { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device } { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device } While my macs got all the simulator runtimes/devices installed and available. $ DEVELOPER_DIR=/Applications/Xcode/Xcode_16.2.app xcrun simctl list devices == Devices == -- iOS 17.5 -- iPhone 15 Pro (48C3EFC6-2B93-4C9D-8C7B-F841CE09E901) (Shutdown) iPhone 15 Pro Max (E2C4D8AA-BF0A-42B4-9D83-70F0CFD21934) (Shutdown) iPhone 15 (350882E2-5A78-47E7-879F-E548F8810386) (Shutdown) iPhone 15 Plus (9FE3F7F6-FAC0-4ACA-96A6-0E8DBBA17068) (Shutdown) ... and in my other macs, still in Sonoma 14.5, xcodebuild -showdestinations command still works well(shows the entire list of available simulator devices). My question is: Did you change the specs of xcodebuild -showdestinations command from the ones working in macOS Sequoia, not to show all the destinations available?
1
0
429
Dec ’24
Updating Swift Packages via command line (Xcode 16)
We have a tool in our CI which periodically updates our iOS project's Swift Package Manager dependencies. The script that does a few things, but generally speaking it first removes the existing package.resolved at ./ProjectName.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved and then runs: xcodebuild -resolvePackageDependencies -disablePackageRepositoryCache This regenerated the package.resolved file to reflect the latest, updated versions of the dependencies. It is the equivalent of doing Xcode > File > Packages> Update to Latest Package Versions. This has been working perfectly for a long time, but has stopped working since we moved from Xcode 15.4 to Xcode 16. I have also tested this with Xcode 16.1 and 16.2 - with no luck. I have tried running this command locally, and can confirm it is not an issue with the environment of our CI. I have also tried swift package update. Both of these commands appear to work - no errors are thrown, and the logs say "resolved source packages". However, they are not updating the packages. They are making no changes to the package.resolved file. However, using Xcode > File > Packages> Update to Latest Package Versions in Xcode 16 works as expected - the packages are updated and the .resolved file is updated. Is there now a different way to update Swift packages via the command line, or is this likely an Xcode 16 bug? Update: This feels broken, so I have submitted a Feedback Report (FB16108036) but perhaps someone can suggest a workaround for the time being!
0
2
443
Dec ’24
Local network privacy dialogue not triggered for bash script inside agent
Hi, I'm trying to set up automated backups on my machine using a combination of restic, a wrapper script, and a launchd agent, but I think I'm hitting a problem with the local network privacy dialogue. Basically, the script sets up the environment variables for Restic, which then tries to backup to a local REST server. Problem is, when trying to do that, I get the following error: Fatal: unable to open config file: Head "https://X:X@X.X.X.network:8000/X/X.X.X.network/config": dial tcp 192.168.50.229:8000: connect: no route to host So it resolves DNS just fine, but can't connect to the local server. I tried a couple of things, tools such as ping work and can ping the local server, but nothing I do fixes the issue with restic itself. After reading about the network privacy feature, which I loved by the way, I believe it's the culprit here. This is the .plist file I'm using, which lives in ~/Library/LaunchAgents/com.james.local-backup.plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.james.local-backup</string> <key>ProgramArguments</key> <array> <string>/Users/james/.local/bin/replicator</string> <string>--backup</string> <string>rest:https://X.X.X.network:8000/X/X.X.X.network</string> </array> <key>EnvironmentVariables</key> <dict> <key>PATH</key> <string>/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string> <key>XDG_CONFIG_HOME</key> <string>/Users/james/.config</string> </dict> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>13</integer> <key>Minute</key> <integer>0</integer> </dict> <key>StandardErrorPath</key> <string>/tmp/com.user.backup.err</string> <key>StandardOutPath</key> <string>/tmp/com.user.backup.out</string> <key>ProcessType</key> <string>Background</string> </dict> </plist> The local network dialogue never shows up, so I can't give the wrapper script or restic access to the local network, which I assume is why it can't connect to the local server. Any way I can solve this? I could build a proper Swift CLI that calls restic, but I assume I'd hit the same issue. Plus, it seems overkill for my needs.
4
0
475
Dec ’24
xctrace symbolizes that the command running result does not meet expectations
When I use the xctrace symbolize command to symbolize a trace file, the command runs normally and ends, but only part of the stack is symbolized in the generated symbolized trace file. If I use Instruments to open the symbolized trace file, I will see the symbolized status of the corresponding library in the symbols window as Awaiting Resymbolication.
1
1
244
Dec ’24