Hi all.
When in terminal I run the command that reads user input from stdin, for example base64 , I can paste or type up to 1024 characters (bytes). After that terminal starts beeping and does not allow me to type or paste anymore input. Where is the terminal input buffer set and how can I increase it?
Thank you
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
97 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Following the latest Command Line Tools update, the swift-nio library (https://github.com/apple/swift-nio) causes my program to segfault.
The function where the error occurs is runIfActive, which is executed with the following error:
Thread 12: EXC_BAD_ACCESS (code=1, address=0x4)
swift version: swiftlang-6.0.0.7.6 clang-1600.0.24.1
NIO version: 2.70.0
I have a Mac Catalyst app bundle built from Rust. I am able to execute this bundle from my M2 Mac-Mini. I am wondering how might I go about creating a proper IPA archive in order to install to my iOS/iPadOS devices.
I am using the following code to generate and sign the app bundle:
cd "${APPDIR}/"
/usr/bin/codesign -s "Apple Development: <ID>" -fv ./counter.app
cd ./counter.app
zip -r ../counter.ipa *
I then use cfgutil to try to install to my iPhone that is plugged into my Mac-Mini:
cfgutil -v install-app ./counter.ipa
I receive the following error when trying to install:
Waiting for the device [1/4] [*******************************************] 100%
cfgutil: error: Information about an app could not be read.
(Domain: ConfigurationUtilityKit.error Code: 404)
"install-app" failed on <>'s iPhone (ECID: <>).
--- Summary ---
Operation "install-app" failed on 1 devices.
The contents of the app bundle before signing:
counter.app/
- Geneva.ttf
- counter
- Info.plist
Contents of Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.example.counter</string>
<key>CFBundleDisplayName</key>
<string>counter</string>
<key>CFBundleName</key>
<string>counter</string>
<key>CFBundleExecutable</key>
<string>counter</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en_US</string>
<key>UILaunchStoryboardName</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
</dict>
</plist>
Is there anything I'm doing wrong in signing and/or creating the IPA archive? Or perhaps I am missing something in the bundle itself?
When I try to use rvictl with an iPad Air, the tool doesn't error out, but also doesn't indicate success. Here are two invocations first with the udid of an iPhone Mini, which succeeds, and second with an iPad Air, which does not:
~/Desktop via 🐦 v6.0 took 3s
❯ rvictl -s 00008110-[snip]
Starting device 00008110-[snip] [SUCCEEDED] with interface rvi0
~/Desktop via 🐦 v6.0 took 5s
❯ rvictl -s 00008112-[snip]
~/Desktop via 🐦 v6.0 took 3s
❯
If I list interfaces I only see rvi0, which corresponds to the iPhone Mini.
I am able to fetch CloudKit records from my MacOS command line tool/daemon.
However, I would like CloudKit to notify my daemon whenever CKRecords were altered so I would not have to poll periodically.
In CloudKit console I see that my app successfully created CloudKit subscription, but the part that confuses me is where in my app do I define callback function that gets called whenever CloudKit attempted to notify my app of CloudKit changes?
My first question - do I need to define callback in my implementation of UNUserNotificationCenterDelegate? NSApplicationDelegate? Something else?
My second question, would CKSyncEngine work from command line application?
In Xcode I have created UI-less application. I tried to add following code:
import CloudKit
let container = CKContainer.default()
And it is failing with:
In order to use CloudKit, your process must have a com.apple.developer.icloud-services entitlement. The value of this entitlement must be an array that includes the string "CloudKit" or "CloudKit-Anonymous".
If I go to project and select my Command Line Tool target I don't see CloudKit capability that I usually see in UI based applications.
So, is it impossible to use CloudKit from Command Line tools?
Hi,
I have been tasked with porting our C++ codebase from Windows/Linux to MacOS.
Our setup uses Premake to generate platform specific project files. On Windows it creates a Visual Studio solution and project files, on Linux it creates makefiles, and on MacOS it generates an Xcode workspace and project files.
Our project hierarchy looks something like this:
Solution/Workspace S
Project A (shared library)
Project B (shared library)
Project C (shared library)
Projects D to R (About a dozen or so - all shared libraries)
Project V (application)
Project W (application)
Project X (application)
Project Y (application)
Project Z (application)
Projects B and C depend on A.
Projects D to R are dependent on some or all of the projects A, B, and C.
Each application is dependent on projects A, B, and C, and some of the intermediate projects D to R. (The exact dependencies vary according to the application.) Additionally, some applications can load shared libraries dynamically according to their state/settings. I.e., not all shared library dependencies are known at build time.
Initially all building typically happens on the command line. Once our build script has run Premake to generate the project files, it proceeds to build everything. Further builds can happen within Visual Studio/Xcode as part of the normal workflow. However, building must happen on the command line for DevOps CI/Release builds.
On Windows, for example, MSBuild lets me build the entire solution for a given configuration (Debug/Release/etc) in a single command. This builds projects A, B, C in order, followed by the intermediate projects (D to R), followed by the applications (V to Z). Each project is built once.
Same deal for Linux. Make builds each project in turn according to the dependencies with a single command. Each project is build once.
On MacOS, however, xcodebuild doesn't let me just build the entire workspace for a given configuration.
I can specify a workspace, but then I have to also specify a scheme. Or I can just specify a specific project.
However, when I build a specific project, Xcodebuild always builds all dependencies.
So my build script at the moment explicitly builds projects D to R, followed by applications V to Z.
This, however, leads to the ridiculous situation of Xcode building projects in the following order:
D, C, B, A
E, C, A
F, C, B, A
G, B, A
etc...
V, F, G, H, C, B, A
W, G, I, C, B, A
X, K, C, B, A
etc...
With the obvious effect of our MacOS builds taking 20+ times longer than their Windows/Linux counterparts.
So, my main questions are:
Is it possible to just build every project in the workspace once?
Or if that can't be done, is it possible to not build project dependencies? I.e., can I just build the single project I specify?
If neither of those are possible, how can I optimise my builds so that they don't take half a day to complete?
I should point out, removing the project dependencies isn't an option. If project A is genuinely out of date, it should be built if I build one of the applications. Xcode should be smart enough to realise that it doesn't need to build everything every time.
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
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.
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
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.
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!
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'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?