FeedbackID: FB13636921
I'm using /usr/sbin/screencapture -v -x -C -k -R 0,0,500,500 /path/to/a/movfile/in/a/folder/in/my/apps/sandbox/Group/Container in my app to allow users to capture screenshots and recordings.
Screenshots keep working fine on macOS Sonoma 14.4b23E5196e, but video recordings no longer work.
I'm guessing the following log output has something to do with it:
default 15:01:53.151819+0100 screencapture sampleBuffer: start recording time: 3123.604833 target: 3123.474266, overshot: 0.130568
error 15:01:53.185179+0100 screencapture <private>:246:<private> Not writable url (null).!folderIsWritable == true
error 15:01:53.185236+0100 screencapture <private>:50:<private> We could not create a byte stream!
error 15:01:53.185252+0100 screencapture <private>:87:<private> NULL byte stream.
error 15:01:53.185298+0100 screencapture <private>:3479:<private> ### Err -45,
error 15:01:53.185312+0100 screencapture <private>:3814:<private> ### Err -45,
error 15:01:53.185334+0100 screencapture <<<< AVCaptureMovieFileOutput >>>> Fig assert: "status == 0 " at (AVCaptureMovieFileOutput.m:2522) - CMIOFileWritingControlTokenStartWriting (err=-45)
error 15:01:53.185374+0100 screencapture <private>:1885:<private> ### Err -67452,
error 15:01:53.185388+0100 screencapture <private>:303:<private> FigMovieFormatFileWriter::PostProcessMovie: WriteMovie() errored!!! -67452
error 15:01:53.185476+0100 screencapture <private>:4687:<private> consolidate movie fragments err : -17913
default 15:01:53.185610+0100 screencapture <<<< AVError >>>> AVLocalizedErrorWithUnderlyingOSStatus: Returning error (AVFoundationErrorDomain / -11800) status (-45)
default 15:01:53.186201+0100 screencapture didFinishRecording: No trim finish. duration: 0.000000s size: 0, error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={AVErrorRecordingSuccessfullyFinishedKey=false, NSLocalizedDescription=The operation could not be completed, NSLocalizedFailureReason=An unknown error occurred (-45), NSURL=file:///Users/eternalstorms/Library/Group%20Containers/group.com.apple.screencapture/ScreenRecordings/3ED15EE7-A814-47A7-A398-29D5A6AD03C1.mov, NSUnderlyingError=0x6000031d80c0 {Error Domain=NSOSStatusErrorDomain Code=-45 "fLckdErr: file is locked"}}
error 15:01:53.186290+0100 screencapture recording failed. The operation could not be completed
Are there new entitlements we need for this in our apps starting with macOS Sonoma 14.4? Or is it a bug? Calling it directly from Terminal works.
Thank you,
Matthias
Command Line Tools
RSS for tagCommand line tools allow for easy installation of open source software or development on UNIX within Terminal.
Posts under Command Line Tools tag
112 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
For MacOS I wrote a Terminal Command Line Tool to help me do number crunching calculations. No need for UI. This works great as-is, but there are opportunities to make the work more interesting by giving it some graphical representation like a heat map of the data. To that end I want the terminal to launch a SwiftUI code to open a window given an optional command line parameter that would display this visual representation of data in a new window. It would be nice to interact with that window visualization in some ways using SwiftUI.
I originally thought it'd just be as easy as creating a SwiftUI View file and then throwing what normally appears under @main into a launch function and then calling the launch function from my main.swift file:
import SwiftUI
struct SwiftUIView: View {
var body: some View {
Text("Hello, World!")
}
}
#Preview {
SwiftUIView()
}
func LaunchSwiftUIApp()
{
//@main
struct SwiftUIApp: App {
var body: some Scene {
WindowGroup {
SwiftUIView()
}
}
}
}
Of course this doesn't work.
I've already have the command line code just spit out various png files via command line so looking to make those visualization a little more interactive or readable/organized by coding some SwiftUI stuff around those current visualizations. Anyway.
Looking around this doesn't seem to be a thing people normally do. I'm not sure how to setup the Terminal Command Line Tool code that I wrote to optionally launch into SwiftUI code.
Hello,
I have a test bundle in my application and one of the strong request of our project is to run ui tests from command line having just application build.
How to run unit tests on .app file that has a test target?
What we tried
xcrun devicectl device install app --device <device-identifier> <UITestBundle-Runner.app>
xcrun devicectl device process launch --device <device-identifier> --start-stopped <com.apptestbundle-Runner.xcrun>
It launches and is waiting pid to be attached.
In lldb:
device select <device-identifier>
device process list
Seeing process 'UITestBundle-Runner' pid.
device process --pid 'pid id'
It attaches and I can see 'debugserver' in the pid list, but it does not start testing and I need tests to start and run.
Thanks!
While running instruments using CLI we are seeing below error:
command: xcrun xctrace record --template Leaks --launch application --output recording.trace -e DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib
Run issues were detected (trace is still ready to be viewed):
[Error] An error occurred trying to capture Leaks data.
[Error] Failed to generate memory graph for pid 7828: failed to create a VMUTaskMemoryScanner, probably because the target's libmalloc hasn't been initialized
Recording failed with errors. Saving output file...
System details:
Xcode 15.4
Mac :Intel processors
MacOs:14.5
Hi 👋
I need assistance in attaching the to the pid in terminal.
In lldb mode I am connecting to the pid using
device process attach --pid <pid-id>
which gives me an error
Process 505 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00000001d505c808 libsystem_kernel.dylib`mach_msg2_trap + 8
libsystem_kernel.dylib`mach_msg2_trap:
-> 0x1d505c808 <+8>: ret
Thanks
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?
I am trying to install the command line tools for Xcode. When I open the installer, it says
Command line tools can't be installed on this disk.
macOS version 14 or later is required
However, About This Mac says that I am running Catalina 1015.7. If I try to install Xcode from the App Store I get the same message.
CURL command with headers stopped working on the latest mac version.
command used to work fine in earlier versions of the Mac OS.
Below command returns error - unkown Header
curl --request GET ‘URL’ --Header ‘Accept-Language:en’ --Header ‘Content-Type: application/json’
Note: If --Header is given in lower case '--header' is seems to be working in the latest version.
Does anyone face this issue and any fix would be really appreciated.
Hello, I'm a beginner and have started learning Swift. I want to create a toy CLI project that needs to read the arguments you pass to it, but I'm unable to figure out how I can run this project from the CLI so I can actually pass arguments to my program. Any idea?
The connection to service named com.apple.testmanagerd was invalidated: failed at lookup with error 3 - No such process.
Currently I am struggling with this problem while running tests runner
`xcrun devicectl device process launch --console --device '000000000000000000000' 'com.gl.RunnerPOC-Watch-AppUITests.xctrunner
What may be causing the issue?
Thanks in advance
I have signed and notarized a single executable file command line tool developed outside Xcode, and distributed outside of the App store by way of a download from a website as follows below, but nevertheless gatekeeper blocks running the tool with the usual message, just like without signing or notarization.
If I remove the com.apple.quarantine xattr, the tool runs as it should without gatekeeper interference, as expected.
I have browsed countless posts here, with similar issues, but in the end I can't find what's wrong with the process.
From what I gather, as long as the target Mac is connected to the Internet, stapling should not be required (I do understand I can't staple a single file executable command line tool), although Gatekeeper would be expected to complain in the case of the first run being done without Internet connection.
The certificate is a "Developer Id Application" certificate, installed and valid on the machine doing the signing.
It is unclear to me what the distinction is between "Developer Id Application" and "Developer Id Installer" certificates, but it's confusing that using -t install with spctl will actually accept the app.
The app is open source and available on GitHub (although the full distribution packaging is done in a separate build environment with some additional logic). The app used below as the target for signing and notarization is available to download from https://www.axantum.com/ in a .tar.gz archive.
Here follows a log of commands and output:
XecretsCli.plist: (This was necessary to add to the signing to avoid corruption of the executable by the code signing)
codesign -s GCXRMT5SQC -f --timestamp -s 0CF6800E595AA6DE9EBB905066619A9BFDD17A77 --entitlements XecretsCli.plist -o runtime XecretsCli
codesign -d -vvv --entitlements :- XecretsCli
Executable=/Users/svante/Downloads/XecretsCli-Osx-2.3.567 3/XecretsCli
Identifier=XecretsCli
Format=Mach-O thin (x86_64)
CodeDirectory v=20500 size=271478 flags=0x10000(runtime) hashes=8473+7 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=d3a8216fcb22b4a4af7bd0157ecc3d2b6be9f9b2
CandidateCDHashFull sha256=d3a8216fcb22b4a4af7bd0157ecc3d2b6be9f9b20c9e3c17e107f08c7ae75c5a
Hash choices=sha256
CMSDigest=d3a8216fcb22b4a4af7bd0157ecc3d2b6be9f9b20c9e3c17e107f08c7ae75c5a
CMSDigestType=2
CDHash=d3a8216fcb22b4a4af7bd0157ecc3d2b6be9f9b2
Signature size=8987
Authority=Developer ID Application: Axantum Software AB (GCXRMT5SQC)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=Jun 20, 2024 at 13:26:05
Info.plist=not bound
TeamIdentifier=GCXRMT5SQC
Runtime Version=13.1.0
Sealed Resources=none
Internal requirements count=1 size=172
Warning: Specifying ':' in the path is deprecated and will not work in a future release
codesign -v -vvv --strict --deep XecretsCli
XecretsCli: valid on disk
XecretsCli: satisfies its Designated Requirement
zip XecretsCli.zip XecretsCli
adding: XecretsCli (deflated 63%)
xcrun notarytool submit "XecretsCli.zip" --keychain-profile "Notarize" --wait
Conducting pre-submission checks for XecretsCli.zip and initiating connection to the Apple notary service...
Submission ID received
id: e5990902-3101-42de-a1a6-b9ea40b944b8
Upload progress: 100.00% (12.4 MB of 12.4 MB)
Successfully uploaded file
id: e5990902-3101-42de-a1a6-b9ea40b944b8
path: /Users/svante/Downloads/XecretsCli-Osx-2.3.567 3/XecretsCli.zip
Waiting for processing to complete.
Current status: Accepted........
Processing complete
id: e5990902-3101-42de-a1a6-b9ea40b944b8
status: Accepted
spctl -a -vvv XecretsCli
XecretsCli: rejected (the code is valid but does not seem to be an app)
origin=Developer ID Application: Axantum Software AB (GCXRMT5SQC)
spctl -a -vvv -t install XecretsCli
XecretsCli: accepted
source=Notarized Developer ID
origin=Developer ID Application: Axantum Software AB (GCXRMT5SQC)
Trying to run the executable:
"XecretsCli" can't be opened
because the identity of the
developer cannot be confirmed.
Your security preferences allow
installation of only apps from the App
Store and identified developers.
Chrome downloaded this file today at
10:37.
OK
Is it planned to add ability to run Xcode test bundles using devicectl tool? If it is possible now how to achieve it?
Is there any other ways to run tests bundle .app file using command line?
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!
When using xcodebuild to build my project, I specify a destination of
generic/platform=macOS
Xcode informs me that my destination is ambiguous as there is a generic destination for Mac Catalyst.
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, name:Any Mac }
{ platform:macOS, variant:Mac Catalyst, name:Any Mac }
At the end of the day, that's OK. It's selected the proper destination by happenstance.
But is there a way t change my destination specifier so that it can zero in on the MacOS destination that is not the MacCatalyst variant?
I've tried using "generic/platform=macOS,variant=". But that does not work.
Assuming I have a static library where all global symbols need to be re-exported by the target executable. How do I extract these symbols into a file to be used with ld's -exported_symbols_list and Xcode's EXPORTED_SYMBOLS_FILE?
I was thinking about nm -gUjo … + sed but maybe there is abetter way?
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?
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.
I would like to use devicectl to take a picture of my iPhone screen on iOS 17.
So far I have successfully performed,
Launching and exiting the app I created.
Reboot the iPhone connected via USB
etc....
I used to use libimobiledevice, but when I bought a new iPhone with iOS17, I can't do it anymore.
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
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